logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: test.php, I get a "404 Not Found" message
Author
DrZ



Joined: 12 Mar 2007
Posts: 6

PostPosted: Mon 12 Mar '07 2:46    Post subject: test.php, I get a "404 Not Found" message Reply with quote

I have been tring to install PHP 5.2 under Apache 2,2, but having no success.

After trying different methods and failing, I found this site.

I followed the instructions by pnllan, except that I used the php5apache2_2.dll.

php.ini file contains absolute paths for doc_root and extension_dir using back slashes.

Apache was restarted with no errors.

When I try to test it using a file test.php, I get a "404 Not Found" message.

What am I doing wrong?
Back to top
pips



Joined: 03 May 2006
Posts: 65
Location: Manchester, UK

PostPosted: Mon 12 Mar '07 10:49    Post subject: Reply with quote

Make sure you have:-

1) the document root set correctly
Code:
DocumentRoot "d:/Apache2/htdocs"


2) index.php is added to the DirectoryIndex line in httpd.conf
Code:
<IfModule dir_module>
    DirectoryIndex index.htm index.php
</IfModule>


3) you have added the AddTypeAplication line to the end of httpd.conf which tells Apache to process PHP files.
Code:
LoadModule php5_module "d:/php521/php5apache2_2.dll"
AddType application/x-httpd-php .php .inc
PHPIniDir "d:/php521"


In your example you would put your test.php file in the d:\apache2\htdocs folder
In your address bar you can then call it by http://localhost/test.php

I have assumed the paths d:\apache2 and d:\php521 as the installation folders for apache and php, change these in the examples to match your installation.

Smile
Hope this helps.
Phil.
Back to top
DrZ



Joined: 12 Mar 2007
Posts: 6

PostPosted: Tue 13 Mar '07 5:23    Post subject: Reply with quote

Thank you for your reply. I went back and rechecked everything. No omissions or errors.

Any other suggestions? I have no clue as to what the cause is.
Back to top
DrZ



Joined: 12 Mar 2007
Posts: 6

PostPosted: Tue 13 Mar '07 7:01    Post subject: Reply with quote

Phil.

After I posted the message, out of desperation, I checked the Apache error log. And found something that may or may not give a clue as to where the problem is (I do not know how to intreprete it):

When a page is not found, error log entry reads something like:
File does not exist: C:path/filename .....

There are many such entries like that, It is normal, since I am doing off-line testing.

However, for the test.php file, the entry reads:
Script C:pathname/test.php' not found or unable to start

I hope you may be able to draw some conclusions. I know, it is like asking you to read tea leaves...

Cheers
Back to top
pips



Joined: 03 May 2006
Posts: 65
Location: Manchester, UK

PostPosted: Tue 13 Mar '07 10:40    Post subject: Reply with quote

It would appear that you've got a typo in your httpd.conf. Make sure your DocumentRoot is set correctly.

It should read c:/path/filename not c:path/filename

Phil
Back to top
DrZ



Joined: 12 Mar 2007
Posts: 6

PostPosted: Tue 13 Mar '07 23:55    Post subject: Reply with quote

I wish that it was the case. But, there is no typo in DocumentRoot. (I installed and configured Apache quite some time ago, and it has been working with vhosts and SSI.)

What I was trying to say about the error log is that:

For other files not found, the entry is "File not found"

However, for test.php, the entry is Script and the absolute path to the test.php file is inside ' '

Is this difference normal? If not, does it give you any indication what the cause may be?

Thanks again.
Back to top
DrZ



Joined: 12 Mar 2007
Posts: 6

PostPosted: Wed 14 Mar '07 1:36    Post subject: Reply with quote

Phil,

I found the cause. I started with the question "Why 404?", did some nosing around and found the cause. Iwas barking ay the wrong tree! It is not PHP, but t is actually due to Apache and vhosts.

Let me explain:
I use vhosts for each site and do not use the main htdocs directory of Apache.
I had put the test.php file in the main htdocs directory, and was trying to call it up by httpd://localhost/test.php

But now comes the surprise:
I made sure that there was no index file in the main htdocs directory, and called up httpd://localhost
Instead of getting the directory listing, I got the index oage of the first registered vhost (in order the vhosts were entred in to the httpd.conf.

I moved the test.php file to one of the vhosts, and everything is fine.

Solved one problem, uncovered another! And, I have no explanation to offer......
Back to top
guolioni



Joined: 23 May 2007
Posts: 3

PostPosted: Wed 23 May '07 14:37    Post subject: php testing error 404 Reply with quote

I got the same problem when i trying to test php 5.2 on apache 2.2.3. the installation of apache 2.2.3 and php 5.2 seem alright. only when i tried to test the info.php on the http://localhost/info.php, i got the error of page not found "404". I checked the error log off apache, it was saying the file of info.php could not be found or be started. I really don't know what's going on. pls help me....

thanks!!!!
Back to top
guolioni



Joined: 23 May 2007
Posts: 3

PostPosted: Wed 23 May '07 14:39    Post subject: Reply with quote

Drz:

I don't know if I got the same problem as yours. caz I don't use vhost at all. although i found some vhosts files under the directory of apache 2.2.3. and i do not have any idea how to deal with it. can you explain again how you did to get the error 404 problem solved.

tks....again!
Back to top


Reply to topic   Topic: test.php, I get a "404 Not Found" message View previous topic :: View next topic
Post new topic   Forum Index -> Other Software