LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Yesterday PHP worked just fine and today it wants to serve up the php code. (https://www.linuxquestions.org/questions/linux-server-73/yesterday-php-worked-just-fine-and-today-it-wants-to-serve-up-the-php-code-689343/)

orsty9001 12-09-2008 10:34 AM

Yesterday PHP worked just fine and today it wants to serve up the php code.
 
I'm using Slackware 12 and Apache. Yesterday everything was working fine. It was just happy serving up php webpages and today it wants to serve up the source code to some browsers and others it wants to let the download the php file. I cannot figure out what's changed from yesterday to today. Nothing in the logs, no resets nothing. Even tried copying my backed up httpd.conf file and resetting my webserver this morning and still wants to do the same thing.

Any suggestions on how to get this back to normal?

lmaza 12-09-2008 10:44 AM

RE-Problem with PHP
 
Maybe the package responsable of php is now broken.



Quote:

Originally Posted by orsty9001 (Post 3369263)
I'm using Slackware 12 and Apache. Yesterday everything was working fine. It was just happy serving up php webpages and today it wants to serve up the source code to some browsers and others it wants to let the download the php file. I cannot figure out what's changed from yesterday to today. Nothing in the logs, no resets nothing. Even tried copying my backed up httpd.conf file and resetting my webserver this morning and still wants to do the same thing.

Any suggestions on how to get this back to normal?


jiml8 12-09-2008 11:10 AM

Is the system allowed to update itself automatically?

You might try putting a php.ini file into the directory that holds the website. I have seen that work before when the symptoms you describe appeared.

orsty9001 12-09-2008 11:21 AM

Quote:

Originally Posted by jiml8 (Post 3369298)
Is the system allowed to update itself automatically?

You might try putting a php.ini file into the directory that holds the website. I have seen that work before when the symptoms you describe appeared.


It's not set to update automatically. It's still Apache/2.2.4, nothing has changed as far as I can tell.

I've actually heard of that php.ini trick before also. Just tried it now since you suggested it and still keeps trying display the php source.

Wim Sturkenboom 12-10-2008 01:46 AM

Not sure if it's the server. I have experienced this with firefox on ubuntu and some sites (like LQ).

It might be conditions on the network (in my case the isp / internet) and happens when my internet experience is 'slow'. Wait a few hours and it's OK again.

orsty9001 12-10-2008 08:46 AM

Quote:

Originally Posted by Wim Sturkenboom (Post 3370097)
Not sure if it's the server. I have experienced this with firefox on ubuntu and some sites (like LQ).

It might be conditions on the network (in my case the isp / internet) and happens when my internet experience is 'slow'. Wait a few hours and it's OK again.

I let it sit over night and still the same thing this morning. I'm going to try later to reinstall PHP.

jiml8 12-10-2008 11:07 AM

It has to be the server, without question. The client system only sees what is shipped to it, and the server should not be shipping the raw PHP code.

If this is a sudden change for no apparent reason, that suggests that perhaps a file has become corrupted. Before reinstalling PHP (which probably is a good choice), I think you might want to run fsck on the affected hard drive/partition.

orsty9001 12-10-2008 02:08 PM

Quote:

Originally Posted by jiml8 (Post 3370585)
It has to be the server, without question. The client system only sees what is shipped to it, and the server should not be shipping the raw PHP code.

If this is a sudden change for no apparent reason, that suggests that perhaps a file has become corrupted. Before reinstalling PHP (which probably is a good choice), I think you might want to run fsck on the affected hard drive/partition.

Drive looks good, no errors. It's like Apache isn't sending the code to the PHP engine to be compiled.

I reinstalled php and upgraded Apache, still doing the same thing. I've found where this has happened a couple of other times on google in other forums. It's really got me stuck.

jiml8 12-11-2008 10:18 AM

I had the same problem appear, but it was on a server that hosts my website and my solution was to contact the hosting company and make them fix it. It happened as part of a major upgrade they were doing to the server, and IIRC they told me that putting a php.ini file in the root of my website solved the problem.

I have never experienced it on the servers I own, hence have never had to figure it out myself, and thus don't know the solution.

What happens when you try to invoke one of your pages from the command line? eg: php mypage.php

If you have command line PHP installed, you should get an html stream back. If you don't, this might be a clue for you.

jstephens84 12-11-2008 03:44 PM

This problem is due in part to Apache not loading the php module correctly and thus does not know how to handle php request. Look through your httpd.conf file for the following three statements. I know you said that nothing has changed but I would still ensure that they are there. Also try a reboot on the server. This has helped me before when I had the same problem.

LoadModule php5_module libexec/libphp5.so
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php

orsty9001 12-12-2008 10:48 AM

When I invoke it from the command line it processes the PHP code. It produces the html that should be sent to the browser which makes me suspect apache.

Also jstephens84, those lines are in httpd.conf. That was the first thing I checked.


All times are GMT -5. The time now is 08:42 PM.