2

When I go to pages in localhost, only php code is shown. This version:

$ php -v
PHP 7.0.10-2+deb.sury.org~xenial+1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.10-2+deb.sury.org~xenial+1, Copyright (c) 1999-2016, by Zend Technologies

I tried to do Upgrade to 16.04. php7 not working in browser but

sudo a2enmod php7.0
ERROR: Module php7.0 does not exist!

When I click tab while

sudo a2enmod php7

it completes to

sudo a2enmod php7.0.load.dpkg-dist

but result is same

$ sudo a2enmod php7.0.load.dpkg-dist 
ERROR: Module php7.0.load.dpkg-dist does not exist!

I installed php like this:

sudo apt-get update
sudo apt-get remove php5-common -y
sudo apt-get purge php5-common -y
sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y
sudo apt-get --purge autoremove -y

I did not enable fpm.

I have all these packages.

$ a2enmod php
php5.6                 php7.0.load.dpkg-dist
$ a2enmod php5.6
Considering dependency mpm_prefork for php5.6:
Considering conflict mpm_event for mpm_prefork:
ERROR: Module mpm_event is enabled - cannot proceed due to conflicts. It needs to be disabled first!
Considering conflict mpm_worker for mpm_prefork:
ERROR: Could not enable dependency mpm_prefork for php5.6, aborting

I delete 5.6 but it's still shown; why?

Zanna
  • 69,223
  • 56
  • 216
  • 327
fff
  • 31
  • 1
  • 1
  • 5
  • How did you install php7 ? – Anwar Sep 07 '16 at 10:21
  • I had 2 php, 5.6 an 7. i deleted all php and installed sudo apt-get install php7.0 php7.0-fpm php7.0-mysql -y and sudo apt-get -y update sudo add-apt-repository ppa:ondrej/php sudo apt-get -y update sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv – fff Sep 07 '16 at 10:28
  • Would you please [**edit**](http://askubuntu.com/posts/822058/edit) your question and update your codes which is more convenient for us to see. Also, in the meantime, would you update the output for `locate bin/php`? – AzkerM Sep 07 '16 at 11:42

1 Answers1

2

You need to choose between mpm_worker vs mpm_prefork (or mpm_event). Only one Apache MPM module. Try:

sudo a2dismod mpm_worker
sudo a2enmod mpm_prefork
sudo systemctl restart apache2.service

Take a look at this excellent answer at Serverfault.

Pablo Bianchi
  • 14,308
  • 4
  • 74
  • 117