0

i'm currently suffering from a problem with my apache server. It won't interpret php after i upgraded my system with

    apt-get update
    apt-get upgrade
    apt-get dist-upgrade

By the way I'm using Debian(Linux version 2.6.32-042stab090.3).

Anyways i've been looking up at various sites to find a solution. They mostly said that in my http.conf/apache2.conf is something missing to include php-files to be interpreted by the php5 interpreter. They suggested that I should add

    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>

to my configfile and other variations but none of them worked. And yes I restartet the apache2 server after editing the config-file. They also said that the regex of the php5.conf could be wrong and lead to a interpreter which doesn't cares about real php-files or whatever. Also some of them suggested that I should run

    sudo apt-get purge libapache2-mod-php5
    sudo apt-get remove libapache2-mod-php5

so that the config-files of php were rebuild correctly, but because I lack of luck it also shows an error:

    Err http://ftp.us.debian.org/debian/ testing/main libapache2-mod-php5filter amd64 5.6.0~rc2+dfsg-1
      404  Not Found [IP: 128.61.240.89 80]
    Unable to correct missing packages.
    E: Failed to fetch http://ftp.us.debian.org/debian/pool/main/p/php5/libapache2-mod-php5filter_5.6.0~rc2+dfsg-1_amd64.deb  404  Not Found [IP: 128.61.240.89 80]

So then there was another suggest which said that i should check the error.log of apache2, but it shows only non-helpful messages for me.

    [Sun Jul 20 01:19:27.468164 2014] [mpm_prefork:notice] [pid 31052] AH00163: Apache/2.4.9 (Debian) PHP/5.6.0RC2 configured -- resuming normal operations
    [Sun Jul 20 01:19:27.468204 2014] [core:notice] [pid 31052] AH00094: Command line: '/usr/sbin/apache2'
    [Sun Jul 20 16:22:25.052630 2014] [mpm_prefork:notice] [pid 31052] AH00169: caught SIGTERM, shutting down

4 Answers 4

4

I had exactly the same problem after upgrading from wheezy to jessie. Aside the fact that they moved from apache 2.2 to 2.4, which led me to a bunch of incompatibilities and errors, php too was not being interpreted anymore.

But as they say, the greatest secrets are held in plain sight, here's how I fixed it (kids easy!).

I was verifying php availability with the short script

<?
 phpinfo();
?>

After a few hours of brain cells damage and getting old, I replaced it with:

<?php
 phpinfo();
?>

And everything worked like a charm.

So it's a PHP problem, not APACHE. It is because apparently the short tag was disabled by default in jessie. Look into your php.ini (/etc/php5/apache2/php.ini) for the 'short_open_tag' parameter, and set it to On, eventually or use the full tag in scripts (<?php). I understand it's a parameter kept for backwards compatibility only, but still there was a rough time looking for it.

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

1 Comment

Same goes for nginx + php-fpm.
1

You should have edited the php.ini file and search for short_open_tag = Off (change Off to On) and then restart the apache2 service. If that tag is off you have to use

Cheers,

Comments

0

Make your error log more verbose by changing LogLevel warn to LogLevel debug in your apache2.conf.

Your error log will be more helpful, I hope.

3 Comments

The only new thing is that it shows which documents are being required by clients, check the error.log on pastebin: pastebin.com/cagqmAiH
Seen in debian doc : Unless you specifically need filter-module support, you most likely should instead install libapache2-mod-php5
as I already mentioned libapache2-mod-php5 is already installed and I tried to purge and remove it, but it won't work. Problem still there.
0

Install the libapache2-mod-php package

sudo apt-get update
sudo apt-get install libapache2-mod-php

Enable the php module in Apache

sudo a2enmod phpx.y  (eg: php7.4  php-v to know version)

Restart apache service

 sudo systemctl restart apache2

Comments

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.