[SOLVED] getting PHP 5 to work with Apache2

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Hmm..weird.
It would be interesting to see the error you get if you drop an test index.php file in C:/Program Files/Apache Group/Apache2/htdocs and goto http://localhost
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

when I do that, I am shown the default Apache page.
It is as if Apache is not regognizing PHP and thus displays its own page.

I do not get any error...
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

That's even weirder as you have DocumentRoot index.php index.html ... which should load an index.php before any index.html

What does http://localhost/index.php show?
It's almost sounding like your DocumentRoot isn't where it's claiming to be as it can't find any of the .php files you are putting in there. In which case it might be worth creating say c:\www and editing httpd.conf to make that your DocumentRoot (just as a test)
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

as I expected, I get the following error:

[client 127.0.0.1] script 'C:/Program Files/Apache Group/Apache2/htdocs/index.php' not found or unable to stat
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I know that errors in your apache error.log, but what actually happens in the browser?
Last edited by markl999 on Tue Jul 06, 2004 5:40 pm, edited 1 time in total.
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

I get the regular 404 error page
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

ok, i'd next try changing your DocumentRoot to c:\www or similar and put an index.php file in there.
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

nope, still same results still the dreadfull 404 page

I don't believe the problem is in httpd.conf
but hey, I am new to this...

I still go to http://localhost/index.php right?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you did restart the service, right?
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

of course.
I restart it after every change to httpd.conf
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

I'd also check there's no stale services running, ctrl+alt+delete and kill any apache.exe's that are running.

I just tried your httpd.conf on my localhost (i only changed the docroot and the changes that have been suggested so far) and it worked ok.
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

I killed all the apache processes and restarted the service.
still nothing.

Let's put the httpd.conf file aside (as you said it works fine for you).
what else can go wrong?
what about the placement of dlls that apache needs in order to communicate with PHP?
where should those be placed?
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

You'de get an error when starting apache if any of the modules failed to find/load any dependencies in the same way you had that mysql dll error previously.

I notice you have your ServerName set to php.myheritage.com, do you have an entry for it in c:\windows\system32\drivers\etc\hosts ?
Something like:
127.0.0.1 php.myheritage.com

If this is a local server then it might be better just to make ServerName localhost
davidklonski
Forum Contributor
Posts: 128
Joined: Mon Mar 22, 2004 4:55 pm

Post by davidklonski »

I changed it to localhost and still nothing.
this is really frustrating...

I don't know what to do
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Well, lets rule out some more bits :o
If you open a command prompt at C:\Program Files\Apache Group\Apache2\bin and run 'apache -t' , it should report 'Syntax OK'
At least that will tell us the httpd.conf file is syntactically correct (which i suspect it is).

Also, if you change the DocumentRoot to another directory (one that exists), as you have Option Indexes set then going to http://localhost should show the directory.
Post Reply