So my server suddenly stopped parsing PHP (sends raw php to the client). I'm not really sure when it happened, but I just noticed it today. I was messing with some mod_rewrite stuff, but I put it back and it didn't change. Other than that I haven't changed anything (to the best of my knowledge). Ideas? It's an Ubuntu 11.10 server, BTW.
-
Have you got any Apache logs? Also, post any apache configuration related to PHP that you have. It might be as simple as the PHP module being commented out.F21– F212012-04-28 07:03:12 +00:00Commented Apr 28, 2012 at 7:03
-
did you tried restarting apache?Shaikh Farooque– Shaikh Farooque2012-04-28 07:04:41 +00:00Commented Apr 28, 2012 at 7:04
-
Also change your mysql password if you have one, as someon may of had a sneek peek at an include config. One of the many reasons why configs should be out of web root.Lawrence Cherone– Lawrence Cherone2012-04-28 07:08:09 +00:00Commented Apr 28, 2012 at 7:08
-
@phpdev nothing in the log files.Finn– Finn2012-04-28 07:25:33 +00:00Commented Apr 28, 2012 at 7:25
-
@ShaikhFarooque Yes, I tried restarting apache, but to no avail.Finn– Finn2012-04-28 07:25:40 +00:00Commented Apr 28, 2012 at 7:25
3 Answers
Few things to try...
First:
apachectl -t -D DUMP_MODULES | grep php
You should get something like:
php5_module (shared)
at the very least.
Secondly... how are you restarting apache? Are you sure it is getting killed? I have used an apache init.d script before that would actually run an apachectl configtest to make sure it was error free before stopping and restarting. So, perhaps you need to stop, ensure it is stopped, then start again.
Also, in your config, make sure you have something like:
<IfModule php5_module>
AddType application/x-httpd-php .php
</IfModule>
You don't necessarily need the <IfModule> directive, but doesn't hurt.
And what version of apache are you running?
1 Comment
Remove the Rewrite setting might be you have return wrong.
And restart the Apache server. Hope that will resolve the issue.
Can refer to
http://www.matthewwittering.co.uk/blog/ubuntu-tips/apache-not-running-php-files.htm
https://askubuntu.com/questions/59272/php-not-working-in-apache2-after-system-upgrade
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>
4 Comments
/var/log/apache2/error.log and the console didn't show any errors when I started it.