skip to Main Content

Recently I a upgraded my Debian server from Jessie to Stretch (Debian 9.5). All went well except that php generated websites are not executing when requested by the web-browser. As for instances http://92.51.132.110/~mlakova/hotglue/hotglue/index.php where i get as a response the php source code and not the generated html.
If I ssh onto the server and execute that same script with php index.php i get the generated html, without errors.

The php --version is PHP 7.0.30-0+deb9u1 (cli)

apache2 has module php7.0 enabled.

php5 is uninstalled and purged

The full phpinfo(); is available in http://92.51.132.110/info.php

The php error log is not showing any errors.

Anyone has leads on why this is happening and how can it be fixed? Might it have to do with the transition from mysql to mariadb?

2

Answers


  1. Chosen as BEST ANSWER

    Solved! It was due to /etc/apache2/mods-available/php7.0.conf having the followings lines, which only required commenting.

    # Running PHP scripts in user directories is disabled by default
    #
    # 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_flag engine Off
     </Directory>
    </IfModule>
    

    After it was only only a question disabling apache module php7.0; restarting apache and enabling the module and restarted did the job! thank you!


  2. I had this problem too. You can fix this problem with these commands. You need to install libapache2-mod and enable apache PHP mode.

    Install:

    sudo apt-get install apache2 php7.x libapache2-mod-php7.x 
    

    Verify:

    a2query -m php7.x
    

    Load:

    sudo a2enmod php7.x
    

    Restart apache:

    sudo service apache2 restart
    

    And you can check.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search