Discussion PHP

I need libphp7.so module to configure apache on Mac OSX/ Centos

I’ll split my answer into two parts. The first part describes how your problem occurred, the second part is the actual answer to your issue.

Description

Disclaimer: Most of my description is basically speculation, as I cannot really know what you did. But it’s the most likely scenario, as I cannot think of another way that would end up giving you the issue you described.

From the problem you describe, it seems you have installed a third party PPA which installed PHP 7.1 on your system. The most likely PPA is Ondrej’s PPA.

When you first installed PHP, you installed in the following method:

sudo apt install php

The php package is only a meta package and does not contain the binaries needed. It depends on the latest version of the available PHP package (by default 7.0). So when you install it, the php7.0package is installed along with php7.0‘s dependencies (and libapache2-mod-php7.0 if you have apache2) and all those dependencies are marked in the package manager as “automatically installed”.

$ apt show php
Package: php
Version: 1:7.0+35ubuntu6
Priority: optional
Section: php
Source: php-defaults (35ubuntu6)
Origin: Ubuntu
Maintainer: Ubuntu Developers 
Original-Maintainer: Debian PHP Maintainers 
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 11.3 kB
Depends: php7.0
Supported: 5y
Download-Size: 2,832 B
APT-Manual-Installed: yes
APT-Sources: http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
Description: server-side, HTML-embedded scripting language (default)
 PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used
 open source general-purpose scripting language that is especially suited
 for web development and can be embedded into HTML.
 .
 This package is a dependency package, which depends on Debian's default
 PHP version (currently 7.0).

I bolded the parts of the command’s result, which explains what I just mentioned.

Ondrej’s PHP PPA offers multiple PHP versions that can be installed alongside each other. So when you added it your system, apt found a newer version of PHP so it replaced php7.0* with php7.1along with any related packages that were automatically installed.

Answer

There are two methods to fix your issues.

  1. Completely remove the 3rd party PPA, and revert back to the default PHP packagessudo apt install ppa-purge sudo ppa-purge ppa:ondrej/php
  2. Ondrej’s PPA offers multiple versions of PHP, so you can install more than one version along side each other. But you would enable only the php7.0 Apache module.sudo apt install php7.0 libapache2-mod-php7.0 sudo a2dismod php7.1 sudo a2enmod php7.0 sudo apache2ctl restart Installing them in the previous manner would set the php7.0 package as “manually installed” in apt, so they won’t get removed automatically without you removing them yourself. Don’t forget to make sure to install any PHP modules you need for php7.0 as well (Like sudo apt install php7.0-mysql)

php7.0 may have been kept in your system installed if you had manually installed a module specifically for php7.0 (for example php7.0-mysql).

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *