Cannot Make PHP Work With Apache
Moderator: General Moderators
-
MikeTenorio3
- Forum Newbie
- Posts: 5
- Joined: Wed Apr 07, 2010 10:40 pm
Cannot Make PHP Work With Apache
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();
?>
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
You did restart Apache after modifying the httpd.conf, right?
-
MikeTenorio3
- Forum Newbie
- Posts: 5
- Joined: Wed Apr 07, 2010 10:40 pm
Re: Cannot Make PHP Work With Apache
Oh sorry. I also restarted apache after modifying httpd.
Re: Cannot Make PHP Work With Apache
Do you see anything if you do a View Source?
-
MikeTenorio3
- Forum Newbie
- Posts: 5
- Joined: Wed Apr 07, 2010 10:40 pm
Re: Cannot Make PHP Work With Apache
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>
<!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
I thought you said you saw nothing.
-
MikeTenorio3
- Forum Newbie
- Posts: 5
- Joined: Wed Apr 07, 2010 10:40 pm
Re: Cannot Make PHP Work With Apache
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
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.
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.
-
MikeTenorio3
- Forum Newbie
- Posts: 5
- Joined: Wed Apr 07, 2010 10:40 pm
Re: Cannot Make PHP Work With Apache
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.