1

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.

5
  • 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. Commented Apr 28, 2012 at 7:03
  • did you tried restarting apache? Commented 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. Commented Apr 28, 2012 at 7:08
  • @phpdev nothing in the log files. Commented Apr 28, 2012 at 7:25
  • @ShaikhFarooque Yes, I tried restarting apache, but to no avail. Commented Apr 28, 2012 at 7:25

3 Answers 3

2

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?

Sign up to request clarification or add additional context in comments.

1 Comment

PHP is enabled, confirmed with that command. I was restarting with the init script, this time I confirmed that it was shut down with ps aux | grep apache which only showed my grep command. And the application.x-httpd-php was in the config
0

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)

Comments

0

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

Rewrite disabled, PHP tags still not being parsed.
I think so, I checked /var/log/apache2/error.log and the console didn't show any errors when I started it.
Have you checked that your server started ? and what port you have configured for the server? and what is your operating system?
Yes the server started. I can access it from my browser and see that it's sending HTML and not parsing the PHP. Port 80 and 443. As mentioned above, I'm running Ubuntu 11.10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.