PHP and Apache2 broken after upgrade to Ubuntu 16.04
Solution 1
Ubuntu 16.04 comes with PHP 7.0. You need to install libapache2-mod-php
package and then disable all traces of PHP5.
- Uninstall PHP5.x package:
sudo apt-get purge php5-common
(this will remove all PHP 5 packages. - Install default (7.0) PHP apache2 SAPI:
sudo apt-get install libapache2-mod-php
- If the apache2 is still broken do:
sudo rm /etc/apache2/mods-enabled/php5.*
to disable PHP5 mod and enable PHP 7.0 withsudo a2enmod php7.0
.
Solution 2
If you are running www from ~userdir/public_html, check the below in /etc/apache2/mods-enabled/php7.0.conf
# 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>
Related videos on Youtube
Nectar
Updated on September 18, 2022Comments
-
Nectar over 1 year
I've been having a lot of trouble fixing up the remains of my server after upgrading to Xenial yesterday.
PHP apps run as a mess of code, and ownCloud 'can't be found on the server' anymore.
It may be something to do with these errors I get when trying to run Apache2 from the command line.
I hope I can get some help on this, a lot of computers rely on this thing :/
I'd provide some more logs, but they are huge and I wouldn't know what parts to provide.
Oh, and I get this error when trying to install PHP5, if this helps.
Thanks in advance.
EDIT: Here's the output from running 'apache2' from the command line:
-
Videonauth about 8 years16.04 runs with PHP 7.0 so if you want to get it working you might want to take a look here at the answer I provided. Feel free to leave an upvote if this helped you.
-
Olathe about 8 yearsWhat are line 140 of
/etc/apache2/apache2.conf
and line 1 of/etc/apache2/mods-enabled/php5.load
? Also, are you willing to use PHP 7.0? -
Nectar about 8 yearsThank you, I'll take a look. I'd be willing to use it if it offers the same compatibility and functionality, which I assume it does :)
-
Nectar about 8 yearsLine 1 is "LoadModule php5_module /usr/lib/apache2/modules/libphp5.so" while Line 140 is "IncludeOptional mods-enabled/*.load"
-
Nectar about 8 years@Olathe Managed to fix PHP by installing PHP5, so that's great. However, Apache still spits out errors when running 'apache2' from the command line, and the ownCloud aoplication on the server still fails to be found by Apache. I've added the output from 'apache2' if it's useful.
-
oerdnj about 8 yearsPlease don't post text as screenshot, instead copy the text and use the Markdown to post it as code.
-
-
Bultack about 8 yearsFine, that helped me to resolve the problem I got after updating to the new version
-
Clain Dsilva over 7 yearsworked great on Linux Peppermint after the upgrade to 16.04
-
Artur Czyżewski about 5 yearsThank you very much, this was the cause of my problem.