PDA

View Full Version : PHP config problems!


labrat
10-28-2003, 08:17 AM
Can anyone help?

I've gotten a little confused trying to configure php4.3.3 for apache2. Now, when I try to view my test php page, it only shows the html part of the page. The test pages extension is ".php" - I've at least got that much right. If anyone can offer any help or pointers, it will be greatly appreciated.

Thanks.

BTW - this is my php code. Just in case it's wrong in any way:


<?php

print ("A test php page.");

?>

freddycodes
10-28-2003, 02:12 PM
No that should be fine, but how are you trying to view the page. Are you accessing through

http://localhost/blah/blah.php

Or are you doing a File > Open from Internet Explorer?

labrat
10-28-2003, 03:21 PM
Yes, locally. I've tested php.exe by typing at the command prompt php -i and the test results were fine. It finds the php.ini path and names php.ini. so that bit's ok.

Could it be a wrongly configured httpd.conf file?

Edit.
btw: I've told Apache to accept pages with .php extensions. You can view the page (http://www.labrat.filetap.com/php) and source if you want.

freddycodes
10-28-2003, 03:56 PM
Okay yeah something ain't right with your httpd.conf You want to post your LoadModule line and your AddType lines that correspond with php/

Have you restarted apache since you added php support?

labrat
10-28-2003, 04:17 PM
My LoadModule line is:
LoadModule php4_module c:\php\sapi\php4apache2.dll

The following is a quote directly from the install.txt file:

AddModule mod_php4.c
AddType application/x-httpd-php .php

Note: Especially newer versions of Apache do not need the
AddModule directive anymore, your milage may vary.


For this reason, I didn't add the AddModule or AddType lines. Are these lines definately required then? And yes I have restarted Apache since installing php. That's how you can view the demo page. If I need to do everything from scratch, I don't mind. I've got lots of time available.

freddycodes
10-28-2003, 04:38 PM
That's how you can view the demo page.

The reason you can view it is Apache doesn't know how to handle it and it shows as plain text. LoadModule had nothing to do with that. Thats why when you view source you see the actual php code. (this is bad bad bad).

Anyways, you may not need the AddModule line but you MUST have the AddType line.

labrat
10-28-2003, 04:46 PM
Shall I put the AddType underneath the LoadModule line?

Stupid question. I found where the AddType line goes and added it to its respective location. I've also restarted the server and the page loads ok now. So was this all the problem was then. Adding the AddType line?

I know it's usually the simple things that get overlooked, but this is hilarious! This one missing line kept me up until 3am this morning.

Thanks for your help and patience.

freddycodes
10-28-2003, 04:48 PM
Yes anywhere under that, maybe a few lines down.