| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| 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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
07-26-2008, 04:25 AM
|
#1
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Rep:
|
Apache 404 index.php not Found but index.php exists at document root
hello all,
i m facing a problem with the apache server and PHP.
The server is running CentOS 5.2 with preconfigured Apache and PHP (5.1.6).
The document root is /home/www
The problem is I can run some files while other files (the ones I create) gives 404 error.
For example there was a file at /home/www/phpinfo.php and it runs well.
However i made a file at /home/www/test.php but when the invoke it from the browser it gives me "Not Found The requested URL /test.php was not found on this server."
I tried with other file without result. Seems like only the files that existed on the system before runs well, if I create new files they cant be found.
I have no idea what could cause this error. I really need some assistance on this matter. Thank you.
|
|
|
|
07-26-2008, 04:27 AM
|
#2
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
I'm guessing selinux. Can you post
ls -lZ /home/www
You could also try accessing those files after temporarily turning selinux off. Type "setenforce 0" as root from a terminal (setenforce 1 to turn it back on)
Last edited by billymayday; 07-26-2008 at 04:28 AM.
|
|
|
|
07-26-2008, 04:29 AM
|
#3
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Here is the result,
[root@cl-t110-070cl www]# ls -LZ /home/www
drwxr-xr-x cl-t110-070cl cl-t110-070cl xxxxxxxxxxx
drwxr-xr-x root root cgi-bin
drwxr-xr-x cl-t110-070cl cl-t110-070cl cl-t110-070cl
drwxr-xr-x cl-t110-070cl cl-t110-070cl cl-t110-070cl.privatedns.com
drwxr-xr-x root root images
-rwxrwxr-x chapal ftp index.php
-rw------- root root nohup.out
-rwxrwxr-x root root phpinfo.php
drwxr-xr-x root root phpMyAdmin
-rwxr-xr-x root root test.php
drwxrwxr-x root root testsite
|
|
|
|
07-26-2008, 04:32 AM
|
#4
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
You could also try accessing those files after temporarily turning selinux off. Type "setenforce 0" as root from a terminal (setenforce 1 to turn it back on)
|
Ok, i m trying and posting the result.
Thanks for the amazingly fast response.
|
|
|
|
07-26-2008, 04:36 AM
|
#5
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
[root@cl-t110-070cl /]# /usr/sbin/setenforce 0
/usr/sbin/setenforce: SELinux is disabled
No luck. Still "The requested URL /test.php was not found on this server." 
|
|
|
|
07-26-2008, 04:37 AM
|
#6
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
That isn't listing and contexts - are you sure you put the "Z" in? Maybe you don't have SELinuz running. Can you post the output of
cat /etc/selinux/config?
|
|
|
|
07-26-2008, 04:39 AM
|
#7
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
Is anything coming up int the httpd logs?
|
|
|
|
07-26-2008, 04:41 AM
|
#8
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Yes, i put Z there, i m copying directly from putty.
Here it is,
cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
# SETLOCALDEFS= Check local definition changes
SETLOCALDEFS=0
|
|
|
|
07-26-2008, 04:42 AM
|
#9
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
It's probably ownership or permissions. Try
chmod g+w test.php
|
|
|
|
07-26-2008, 04:47 AM
|
#10
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
It's probably ownership or permissions. Try
chmod g+w test.php
|
Just tried, sitll same error.
Quote:
|
Originally Posted by billymayday
Is anything coming up int the httpd logs?
|
Sir, I m new to this. Can you tell me where is the log file located ?
|
|
|
|
07-26-2008, 04:53 AM
|
#11
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Found the log..
the last several lines have same messeges.
[Sat Jul 26 05:48:54 2008] [error] [client 123.49.40.160] script '/home/www/my_ip_address/test.php' not found or unable to stat
Do you want me to post the entire log ?
[EDIT]
oh why is it looking in /home/www/my_ip_address/test.php ?
shouldnt it look at /home/www/test.php ?
Last edited by mark84; 07-26-2008 at 04:55 AM.
|
|
|
|
07-26-2008, 05:00 AM
|
#12
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
No, but what's the "xxxxxmyipxxxx" bit (did you overtype this or is this exactly what it said)?
As the message says, apache is looking for /home/www/xxxxxmyipxxxx/test.php not /home/www/test.php
Can you post the output of
find /home/www -name phpinfo.php
and note any references in httpd.conf (in /etc/httpd/conf) of DocumentRoot
|
|
|
|
07-26-2008, 05:02 AM
|
#13
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Now i have put the test.php at /home/www/my_ip_address/test.php and its working.
Shouldnt it work from /home/www/test.php as my DOCUMENT_ROOT is set to /home/www/ ?
Why is it looking inside /home/www/my_ip_address/ ?
How can i reconfigure the doc root to /home/www/ ?
Thanks for the help so far. Really appreciate it. 
|
|
|
|
07-26-2008, 05:06 AM
|
#14
|
|
Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678
Rep: 
|
post
grep DocumentRoot /etc/httpd/conf/httpd.conf
and maybe
find /etc/httpd/conf.d -type f | xargs grep DocumentRoot
|
|
|
|
07-26-2008, 05:08 AM
|
#15
|
|
LQ Newbie
Registered: Feb 2007
Posts: 21
Original Poster
Rep:
|
Quote:
Originally Posted by billymayday
No, but what's the "xxxxxmyipxxxx" bit (did you overtype this or is this exactly what it said)?
|
I changed it to xxxxxxx it was the actual ip address like 62.178.90.12
Quote:
Originally Posted by billymayday
As the message says, apache is looking for /home/www/xxxxxmyipxxxx/test.php not /home/www/test.php
|
Yes, the /home/www/xxxxxmyipxxxx/ was a symbolic link to /home/www/cl-t110-070cl.privatedns.com
To give you a better view,
Dir listing of /home/www
[root@cl-t110-070cl www]# ls -l
total 36
lrwxrwxrwx 1 root root 28 Jul 21 13:42 67.205.111.202 -> cl-t110-070cl.privatedns.com
drwxr-xr-x 2 root root 4096 Jul 21 13:42 cgi-bin
lrwxrwxrwx 1 root root 28 Jul 21 13:42 cl-t110-070cl -> cl-t110-070cl.privatedns.com
drwxr-xr-x 2 cl-t110-070cl cl-t110-070cl 4096 Jul 26 05:59 cl-t110-070cl.privatedns.com
drwxr-xr-x 3 root root 4096 Jul 21 13:42 images
-rwxrwxr-x 1 chapal ftp 38 Jul 25 18:07 index.php
-rw------- 1 root root 24 Jul 21 13:42 nohup.out
-rwxrwxr-x 1 root root 43 Jul 25 18:23 phpinfo.php
drwxr-xr-x 11 root root 4096 Jul 21 13:42 phpMyAdmin
-rwxrwxr-x 1 root root 43 Jul 25 18:24 test.php
drwxrwxr-x 2 root root 4096 Jul 26 05:03 testsite
Dir Listing of /home/www/
[root@cl-t110-070cl www]# cd cl-t110-070cl.privatedns.com
[root@cl-t110-070cl cl-t110-070cl.privatedns.com]# ls -l
total 4
lrwxrwxrwx 1 root root 10 Jul 21 13:42 cgi-bin -> ../cgi-bin
lrwxrwxrwx 1 root root 9 Jul 21 13:42 images -> ../images
lrwxrwxrwx 1 root root 14 Jul 21 13:42 phpinfo.php -> ../phpinfo.php
lrwxrwxrwx 1 root root 13 Jul 21 13:42 phpMyAdmin -> ../phpMyAdmin
-rwxr-xr-x 1 root root 43 Jul 26 05:59 test.php
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 01:43 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
|
|