Page 1 of 1

Cannot Make PHP Work With Apache

Posted: Wed Apr 07, 2010 11:05 pm
by MikeTenorio3
I've tested to see if my php works with apache but the reply i get in my browser is that the link appears to be broken. I'm supposed to see a lot of configuration information but nothing. I've installed mySQL Apache and PHP. Tested apache to see if it works and it said "it works". I put the following code in the httpd file which is under program files/Apache Software Foundation/Apache2.2/conf/httpd:

LoadModule php5_module c:/php/php5apache2_2.dll
PHPIniDir "C:/php/"
AddType application/x-httpd-php .php .html

I copied from c:/php, php.ini-recomended file to place and rename it as php.ini in the c:/php file. Added a copy of php.ini to my windows path. Finally I added to the Apache installation file under htdocs the following code:

<?php
phpinfo();
?>

Re: Cannot Make PHP Work With Apache

Posted: Wed Apr 07, 2010 11:29 pm
by requinix
You did restart Apache after modifying the httpd.conf, right?

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 12:46 pm
by MikeTenorio3
Oh sorry. I also restarted apache after modifying httpd.

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 2:12 pm
by requinix
Do you see anything if you do a View Source?

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 4:39 pm
by MikeTenorio3
I did a view source and this is what I got:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /phpinfo.php was not found on this server.</p>
</body></html>

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 10:13 pm
by requinix
I thought you said you saw nothing.

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 10:39 pm
by MikeTenorio3
I'm still a beginner at programming and I didn't know you could do a view source. I just saw a response from the browser saying link broken at that time.

Re: Cannot Make PHP Work With Apache

Posted: Thu Apr 08, 2010 10:47 pm
by requinix
Are you sure you put the file (named phpinfo.php) in the appropriate folder (being install-dir\htdocs by default)?

Could it be that you used, say, Notepad, and accidentally saved the file as phpinfo.php.txt?


Also, the confusion is that PHP will occasionally output nothing. A Not Found or an Internal Server Error are very different from that. So when you say "nothing" we assume literally nothing.

Re: Cannot Make PHP Work With Apache

Posted: Fri Apr 09, 2010 1:59 pm
by MikeTenorio3
That was it. I didn't save my file in a php format. The file was showing a php format but it wasn't actually using it. I should probably upgrade to windows 7. Thanks for all your help.