0

After the upgrade to Ubuntu 16.04, php files in the public_html directory are not processed anymore by apache2. If I browse some page http://localhost/~myusername/index.php, the php code is rendered as plain text.

It might be related to the upgrade to php7.0, which (I think) replaced php5 in Ubuntu 16.04.

I already tried what is suggested in the following:

Any idea about what might be wrong?

  • 1
    can you also post snippet of apache virtualhost configuration, will help in finding problem? – Akshay Pratap Singh Aug 13 '16 at 10:40
  • you can also reinstall apache and php if you do want to waste more time in debugging the problem. – Akshay Pratap Singh Aug 13 '16 at 10:43
1

I solved reinstalling PHP, as follows.

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql libapache2-mod-php
sudo a2enmod php7.0
sudo service apache2 restart

I also edited the file /etc/apache2/mods-available/php7.0.conf in order to allow PHP in user directories (and then, again, restarted apache2).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.