Cannot Make PHP Work With Apache

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
MikeTenorio3
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2010 10:40 pm

Cannot Make PHP Work With Apache

Post 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();
?>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot Make PHP Work With Apache

Post by requinix »

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

Post by MikeTenorio3 »

Oh sorry. I also restarted apache after modifying httpd.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot Make PHP Work With Apache

Post by requinix »

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

Post 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>
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot Make PHP Work With Apache

Post by requinix »

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

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Cannot Make PHP Work With Apache

Post 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.
MikeTenorio3
Forum Newbie
Posts: 5
Joined: Wed Apr 07, 2010 10:40 pm

Re: Cannot Make PHP Work With Apache

Post 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.
Post Reply