require_once() Permission Error

I’ve got a permission error which is driving me mad. Here’s the error I’m getting:

require_once(/srv/path/include.php): failed to open stream: Permission denied.

Now, the require_once() function is being called from: /home/path/index.php

I’ve ensured that permissions are correct, even to the extend of running chmod -R 777 on the entire /srv/ directory (now put back, of course).

What could the problem be? Any help would be greatly appreciated!

it could be a chown issue rather than a chmod issue?

I also tried chown -R apache:apache /srv to no avail :frowning:

Is the server running in safe_mode?

(if you cannot get the ini file, query with ini_get() maybe?)

I’ve just checked php.ini and ‘safe_mode = Off’.

is the path :


actually an alias for


or are there more than one /srv/path paths?

(or the other way round, sorry, I’m grasping at straws now)

I came across a similar prob when starting out in *nix, and I kinda got round it by having a PHP script actually write a file say, test.php, then I could just edit it with vim and so on and it worked.

I had put this down to my own ignorance at the time, and figured it must have been a chmod/chown error on my part.

(safe mode enforces matched ownership requirements on files)

Also, check your include_path string very carefully, there are diffs between *nix / win32 handling of slashes, separators ( ; or : ) etc.

Try setting include_path at the script level with ini_set();

Hi Cups,

Thanks for your help again but unfortunately nothing is working - this is really driving me crazy!

If anyone else has any idea please let me know.