Finn
Finn

Reputation: 374

Apache suddenly not parsing php

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.

Upvotes: 1

Views: 3675

Answers (3)

Shaikh Farooque
Shaikh Farooque

Reputation: 2640

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>

Upvotes: 0

sberry
sberry

Reputation: 132138

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?

Upvotes: 2

remort
remort

Reputation: 314

check:

  • that PHP files have their executable bit set
  • that "index.php" is set as one of default index files in your web root
  • that php module is loaded by apache (see apache config file, perhaps near by enabling mod_rewrite module)

Upvotes: 0

Related Questions