PHP is_dir总是返回false

I am trying to use the is_dir function, but it always returns false even if the directory does indeed exist. I am a very new Linux user(xubuntu), and i read in similar questions here that the issue is probably the directory permission. I have tried using:

sudo chmod -R folder_path

But it's still not working. How can i fix it? Thanks.

EDIT: I forgot to mention that i am working in codeigniter. I have tried to use file_exists(which like is_dir doesn't work in my codeigniter project) on 2 separate files, and it worked. Is it possible that the problem is because i am using codeigniter?

You forgot about permissions, use:

sudo chmod -R 775 folder_path

Also remember that is_dir() function caching the result, from documentation:

Note: The results of this function are cached. See clearstatcache() for more details.

Maybe this is Your problem?

Or Try to use absolute path instead of relative one.

I found out what the problem was. It was the .htaccess that cause the problem, because it was on Deny from all so that cause the problem that i had. I changed it to Allow from all, and now it works well. Sorry for not explain myself better, but the problem is solved so thank you very much for your help.