1

I updated PHP 5 to PHP 7, but I noticed the old version was still configured in my Apache server, so I uninstalled it. Then everything got messy and being all this confusing as this is unless you're an experienced administrator, I just reinstalled apache2 with PHP 7.

However, now the PHP module is not even working because text is being rendered plainly. I am trying to reinstall the PHP 7 module into my apache server but something weird is happening:

When I try installing it with sudo apt-get install libapache2-mod-php7.0, I am getting a dpkg error, but the module is being installed because if I run sudo apt-get remove libapache2-mod-php7.0 it can be uninstalled.

So what can I do? How can I properly install and configure the PHP 7 module in Apache?

Edit

I ran sudo dpkg --configure -a and got this output:

Configuring libapache2-mod-php7.0 (7.0.7-4+deb.sury.org~trusty+1) ... 

dpkg: error processing package libapache2-mod-php7.0 (--configure):   
    subprocess installed post-installation script returned error exit status 1 

Errors were found processing:
    libapache2-mod-php7.0
  • Could you include the data from the dpkg error, please? – anonymous2 Jun 8 '16 at 13:40
  • I can't. That's the thing. There is no description of the error, just " Sub-process /usr/bin/dpkg returned an error code (1)". – dabadaba Jun 8 '16 at 13:47
  • Ah! I see. What's the output of sudo dpkg --configure -a? – anonymous2 Jun 8 '16 at 13:47
  • Configuring libapache2-mod-php7.0 (7.0.7-4+deb.sury.org~trusty+1) ... dpkg: error processing package libapache2-mod-php7.0 (--configure): subprocess installed post-installation script returned error exit status 1 Errors were found processing: libapache2-mod-php7.0 (I had to translate so it might not look exactly the same than the original English message) – dabadaba Jun 8 '16 at 13:56
  • done, check it out – dabadaba Jun 8 '16 at 14:04
0

Disable 5.6 mod first

sudo a2dismod php5.6

Now you should enable PHP7 ones:

sudo a2enmod php7.0

To reflect changes Apache restart is required:

sudo service apache2 restart
| improve this answer | |

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.