LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 11-21-2009, 09:25 AM   #1
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Rep: Reputation: 0
Question 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.
 
Old 11-21-2009, 10:07 AM   #2
prik420
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Rep: Reputation: 0
check the apache logs

what's the url where you're getting the error?
 
Old 11-21-2009, 10:13 AM   #3
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
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.
 
Old 11-21-2009, 11:33 AM   #4
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Original Poster
Rep: Reputation: 0
Question Permission Denied PHP web pages

Quote:
Originally Posted by prik420 View Post
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???
 
Old 11-21-2009, 11:38 AM   #5
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Original Poster
Rep: Reputation: 0
Question Permission Denied PHP web pages

Quote:
Originally Posted by Web31337 View Post
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.
 
Old 11-21-2009, 09:03 PM   #6
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
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 09:04 PM. Reason: ini_get check is in place
 
Old 11-22-2009, 08:25 AM   #7
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Original Poster
Rep: Reputation: 0
Smile Permission Denied PHP web pages

Quote:
Originally Posted by Web31337 View Post
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!!
 
Old 11-22-2009, 09:31 AM   #8
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
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"
 
Old 11-23-2009, 08:48 AM   #9
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Web31337 View Post
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.
 
Old 11-23-2009, 11:53 PM   #10
prik420
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Rep: Reputation: 0
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.
 
Old 11-25-2009, 09:10 AM   #11
Woogieman
LQ Newbie
 
Registered: Oct 2009
Location: Eugene, OR and Klamath, CA
Distribution: CentOS 5.4
Posts: 16

Original Poster
Rep: Reputation: 0
Cool Permission Denied PHP web pages

Quote:
Originally Posted by prik420 View Post
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!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a bash script from PHP - permission denied helsing Linux - Server 3 08-21-2008 07:30 AM
permission denied, uploading to folder /etc/php.ini notiq Linux - Newbie 3 09-13-2007 05:34 AM
open php web pages dyool Ubuntu 3 08-19-2006 06:59 AM
php failed: Permission denied (13) in rino.caldelli Linux - Software 2 03-18-2006 11:25 AM
FC3, PHP 4.3.9, and fopen PERMISSION DENIED Cottsay Programming 4 06-25-2005 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration