Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-21-2009, 10:25 AM
|
#1
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Rep:
|
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.
|
|
|
11-21-2009, 11:07 AM
|
#2
|
LQ Newbie
Registered: Jun 2008
Posts: 18
Rep:
|
check the apache logs
what's the url where you're getting the error?
|
|
|
11-21-2009, 11:13 AM
|
#3
|
Member
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Rep:
|
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.
|
|
|
11-21-2009, 12:33 PM
|
#4
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Original Poster
Rep:
|
Permission Denied PHP web pages
Quote:
Originally Posted by prik420
check the apache logs
what's the url where you're getting the error?
|
This is from my error.log file from Apache.
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/ are drwxr-xr-x
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??? 
|
|
|
11-21-2009, 12:38 PM
|
#5
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Original Poster
Rep:
|
Permission Denied PHP web pages
Quote:
Originally Posted by Web31337
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.
|
Thanks for the tip on the files thing.
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.
|
|
|
11-21-2009, 10:03 PM
|
#6
|
Member
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Rep:
|
how's that:
Quote:
I am logged in and running the web server as root.
|
you mean you start webserver under root and then it runs under something like www-data (unprivileged user) or you run it all under root? then i don't understand why "permission denied".
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');
Last edited by Web31337; 11-21-2009 at 10:04 PM.
Reason: ini_get check is in place
|
|
|
11-22-2009, 09:25 AM
|
#7
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Original Poster
Rep:
|
Permission Denied PHP web pages
Quote:
Originally Posted by Web31337
how's that:
you mean you start webserver under root and then it runs under something like www-data (unprivileged user) or you run it all under root? then i don't understand why "permission denied".
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');
|
Yea I'm a newbie and self taught with a background in Novell and Windows Networks. I know just enough to be dangerous. I run the whole shebang logged in as 'root'. I have not been able to figure out how to create a super-user to replace root.
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!!
|
|
|
11-22-2009, 10:31 AM
|
#8
|
Member
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Rep:
|
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"
|
|
|
11-23-2009, 09:48 AM
|
#9
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Original Poster
Rep:
|
Quote:
Originally Posted by Web31337
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"
|
Thanks for the tip on the path I will do that today;
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.
|
|
|
11-24-2009, 12:53 AM
|
#10
|
LQ Newbie
Registered: Jun 2008
Posts: 18
Rep:
|
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.
|
|
|
11-25-2009, 10:10 AM
|
#11
|
LQ Newbie
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16
Original Poster
Rep:
|
Permission Denied PHP web pages
Quote:
Originally Posted by prik420
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.
|
Thanks for the tip. That is exactly what I did. Except I made my 1 FTP user the owner of the directory(s) and apache is the main group. After doing that on all files I now know what the process is.
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 01:24 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|