Permission Denied PHP web pages
I copied an existing web site from a CentOS 5.4 box to another CentOS 5.4 box to the /var/www/html directory. I only have 1 web site on this box.
I changed the owners of all files to Group Apache and User ftpman. FTP works fine and lets me login, copy and delete files. VNC also works fine. I can load part of the index.php file when load the site but the include files located in other directories give Apache "permission denied" error I am stuck!!! Help!!! I made sure all php files have permissions of -rwxr-xr-x or 0755 in all of the sub-directories also. Any help will be greatly appreciated. |
check the apache logs
what's the url where you're getting the error? |
no need to set 0755 perms on files, 0755 is for directories. 0644 is for files.
and apache won't give permission denied, it's PHP who gives it. what is the absolute path of file you are trying to include()? what is the user webserver is working under? can you su to webserver's user and read that file? double-check permissions and owners. |
Permission Denied PHP web pages
Quote:
PHP Warning: include(atomix/support/HitCounter.php) [<a href='function.include'>function.include</a>]: failed to open stream: Permission denied in /var/www/html/index.php on line 191 The PHP code at line 191 is simply Code:
include("atomix/support/HitCounter.php"); The permissions on the directory /atomix/support/ are also the same The permissions on the file HitCounter.php is -rwxr-xr-x as are all the PHP files on the entire site. See my Quagmire??? :banghead: :scratch: |
Permission Denied PHP web pages
Quote:
I am logged in and running the web server as root. Refer to the preceding response from me on the file particulars. Greatly appreciate all your help. |
how's that:
Quote:
my last guess: include_path in php.ini doesn't contain . at the first place? try include("./atomix/support/HitCounter.php"); -- upd: check echo ini_get('include_path'); |
Permission Denied PHP web pages
Quote:
I hope I got this right. my include_path var was commented out and read: ;include_path = ".:/php/includes" Which I changed to: include_path = "." Is this correct? Or do I need to add a directory name after the . If so what is the separator between directories? Once again thanks a lot for your time!! |
does it work now? i have no idea how that can result in "permission denied" under root o_0
basically it's a good practice to establish the full path of your application's includes directory on the target system and then work with it. just in addition you may change include_path to ".:/var/www/html" |
Quote:
It works now but what I did is change the Owner and Group for the site. I changed the owner to Apache and the Group to ftp-users. Everything works now except my FTP won't let me overwrite files. I am slowly getting it and only have to finish the FTP and I am cooking. I really appreciate your help. Too much information fills up the memory banks and I need to flush every once in a while. Thanks again. |
for ftp, try this workaround:
add your user to the ftp-users group then add write permissions for this group to the /var/www/html folder, recurse if needed. i hope this helps. |
Permission Denied PHP web pages
Quote:
I really appreciate your help and I have solved the problem with the help of everyone here. Thanks again!!! |
All times are GMT -5. The time now is 08:14 AM. |