Page 1 of 1

PHP Suddenly Stopped Working

Posted: Tue May 26, 2009 9:38 am
by Gamester42
Hello guys,

New here :D

I am pretty new to PHP and I am having a really weird problem with it that I have been fighting for several days now. I am on a Windows XP system and I initially installed the newest XAMPP package to use PHP to develop a website in Microsoft Expressions. I installed XAMPP and it worked great as my browsers could display PHP files and my Microsoft Expressions worked with PHP files and had several options for PHP available.

This all worked for about 2 days and then suddenly PHP files no longer display correctly in browsers. Now when I open PHP files it just shows the code, but does not run it. It does this both in Firefox and IE6. Also all the options associated with PHP in Microsoft Expressions are now grayed out and are unavailable. I have not made any software changes or updates on my system prior to this problem.

So, I tried completely uninstalling XAMPP and restarted my computer, then reinstalled XAMPP, didn't work. So I uninstalled it again and tried installing WAMP instead and it too could not display PHP pages correctly.

I really have no idea what could be causing this. My Apache and MySQL services appear to be running with no problems. It just seems that my PC has just completely lost its ability to recognize PHP files.

Any help I could received on this would be greatly appreciated.

Thank you,
Jason

Re: PHP Suddenly Stopped Working

Posted: Tue May 26, 2009 11:12 am
by McInfo
What does the URL look like in your browser's address bar? Does it start with "http://localhost/" or "file:///C:/xampp/htdocs/"?

Edit: This post was recovered from search engine cache.

Re: PHP Suddenly Stopped Working

Posted: Tue May 26, 2009 2:22 pm
by Gamester42
Right now I have WAMP installed and I am running it from the root directory through localhost. I am not at home right now, but I think it looks something like this for example: http://localhost/MySite.php. Something similar to that.

BTW, I have also tried installing different versions of PHP, but no go.

Thanks,
Jason

Re: PHP Suddenly Stopped Working

Posted: Tue May 26, 2009 5:56 pm
by McInfo
Here are some things to try.

A
Open Notepad and type

Code: Select all

<?php phpinfo(); ?>
Save the file as
  • C:\wamp\www\phpinfo.php or
  • C:\xampp\htdocs\phpinfo.php
with these settings:
  • Save as type: All Files (*.*)
  • Encoding: ANSI
In your browser, navigate to http://localhost/phpinfo.php.

B
In one of these files
  • C:\wamp\bin\apache\Apache2.2.11\conf\httpd.conf
  • C:\xampp\apache\conf\extra\httpd-xampp.conf
  • C:\xampp\apache\conf\httpd.conf
find a line that reads

Code: Select all

AddType application/x-httpd-php .php
Make sure the line exists and that there is no # in front of it.

C
Try creating a file named
  • C:\wamp\www\.htaccess or
  • C:\xampp\htdocs\.htaccess
which contains

Code: Select all

AddType application/x-httpd-php .php
Edit: This post was recovered from search engine cache.

Re: PHP Suddenly Stopped Working

Posted: Wed May 27, 2009 8:19 pm
by Gamester42
Hey McInfo,

You helped me realize what was going on with my system. I noticed after I ran <?php phpinfo(); ?> that it said my php.ini was in C:program files/PHP instead of my server root directory. Some how I must have installed a local copy of PHP to Program files and it was using that one. I uninstalled that PHP and then WAMP and XAMPP picked up on it right away.

Got another problem that you or someone might know by chance. I am installing the Zend Optimizer 3.3.3 to my XAMPP server and I am getting an error. I get to the section of the install that asks for the Apache server root directory. I put in C:\xampp\htdocs and it gives me this error:

Image

C:\xampp\htdocs is my root directory, but my httpd.conf is located in C:\xampp\apache\conf, however it is not accepting that path ethier.

Any ideas on that one?

Thanks again,
Jason

Re: PHP Suddenly Stopped Working

Posted: Wed May 27, 2009 8:42 pm
by McInfo
When it asks for the Apache server root directory, it means C:\xampp\apache. I think you are confusing "Apache server root" and "document root".

Edit: This post was recovered from search engine cache.

Re: PHP Suddenly Stopped Working

Posted: Thu May 28, 2009 12:34 am
by Gamester42
Yep, that is what I was doing, lol. Thanks a bunch for clearing that up for me McInfo.

All is working good now! :D

Thanks again,
Jason