PHP Suddenly Stopped Working

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
Gamester42
Forum Newbie
Posts: 4
Joined: Tue May 26, 2009 9:04 am

PHP Suddenly Stopped Working

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: PHP Suddenly Stopped Working

Post 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.
Last edited by McInfo on Tue Jun 15, 2010 4:23 pm, edited 1 time in total.
Gamester42
Forum Newbie
Posts: 4
Joined: Tue May 26, 2009 9:04 am

Re: PHP Suddenly Stopped Working

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: PHP Suddenly Stopped Working

Post 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.
Last edited by McInfo on Tue Jun 15, 2010 4:26 pm, edited 1 time in total.
Gamester42
Forum Newbie
Posts: 4
Joined: Tue May 26, 2009 9:04 am

Re: PHP Suddenly Stopped Working

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: PHP Suddenly Stopped Working

Post 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.
Last edited by McInfo on Tue Jun 15, 2010 4:28 pm, edited 1 time in total.
Gamester42
Forum Newbie
Posts: 4
Joined: Tue May 26, 2009 9:04 am

Re: PHP Suddenly Stopped Working

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