How do I purge PHP 7, install PHP 5.6, and still get phpMyAdmin?
you may need to disable the proxy_fcgi
apache module:
sudo a2dismod proxy_fcgi proxy; sudo service apache2 restart
- 1. Re-Install PHP 5.6
Actually is not required to remove php7.0
, you can install php5.6 together ( also because you will have dependency problem with phpmyadmin
package that required php7.0)
Assuming libapache2-mod-php
is a suitable way to enable PHP in Apache for you, you can proceed in this way:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
Related videos on Youtube
![Questioner](https://i.stack.imgur.com/nzyQw.png?s=256&g=1)
Questioner
Updated on September 18, 2022Comments
-
Questioner almost 2 years
I have a local testing machine, with a fresh install of Ubuntu Mate 16.10. The default PHP installation is PHP 7. However, I need to run php 5.6 in order to keep inline with the servers I develop for.
I tried to remove PHP 7 and install PHP 5.6 using the instructions in this answer, as well as this answer.
It seemed I could have both PHP 7 and 5.6 installed side by side, but switch Apache to use PHP 5.6, but after attempting to have this set up, there were problems. I may be wrong, but it appeared that Apache was still connecting to some PHP 7 modules, or at the very least the PHP 5.6 installation was not fully successful. Whatever was happening, my sites were breaking.
So, I thought I might try to purge PHP 7, but, that took away some modules that I wanted to keep, such as phpMyAdmin. If I try to install just phpMyAdmin via apt-get, I get PHP 7 modules installed.
I'm afraid my tinkering has left my system in a bit of a mess, so I'd like to clean things up and start fresh. To that end, I'd like to purge PHP 7, install PHP 5.6, and install phpMyAdmin.
Or, at the very least, I need to have a system that works exactly like the servers I develop for, where PHP 5.6 is installed (in other words, purging PHP 7 is not the goal, making PHP 7 not interfere in any way with PHP 5.6 is). How can I get that to happen?
UPDATE:
After following some advice in the comments, I have a functioning PHP 5.6 environment that allows my sites to run on my local testing machine the same way they do on the servers.
phpMyAdmin also seems to be installed, by which I mean I have intalled it via apt-get on the command line and the installation went without errors. But it is not working. When I load up phpMyAdmin, I just get a blank screen.
Various sites I've been to suggest that the solution should be to run
sudo apt-get install --reinstall phpmyadmin
,sudo apt install php-gettext
, orsudo dpkg-reconfigure phpmyadmin
, but none of these helped. Right now, I don't know if phpMyAdmin is broken because of a conflict between PHP 7 and PHP 5.6, or if there is some other issue.-
fkraiem over 7 yearsWhen you try to install PMA and it wants to pull some PHP 7 modules, have you tried first installing the PHP 5.6 versions of these modules, and then install PMA?
-
Jakob Lenfers over 7 yearsI guess PMA simply has dependencies to php, which is version 7 in Ubuntu 16.*. Did you consider to install PMA simply "from source"?
-
Questioner over 7 years@fkraiem, Thank you for responding. It's unclear to me if PMA 5.6 modules exist in the repositories. Like, so far as I can see, there isn't a PMA 5.6 and a PMA 7 when I use Synaptic to search for what's available. There's just a PMA module, and then if I install it, it says it has PHP 7 dependancies.
-
Questioner over 7 years@JakobLenfers,Thank you for responding. I don't know how to install "from source". I was hoping there was a way I could install the right repository and it would give me PMA on a PHP 5.6 base.
-
fkraiem over 7 yearsFor example,
phpmyadmin
depends onphp-mysql
. If you just try to installphp-mysql
, it will installphp7.0-mysql
. However, if you manually installphp5.6-mysql
, this may be sufficient to satisfy the dependency. -
Questioner over 7 years@fkraiem, thank you for the suggestion. I first installed
php5.6-mysql
, then I installed PMA again. When I installed PMA, it brought with it PHP 7 modules, but, by runningsudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
, I think I've side stepped PHP 7's interference. Right now my situation is that my web sites are working indicating I have a functioning PHP 5.6 environment. Unfortunately, though, PMA is not running, I just get a blank screen. So, something in this process has broken the PMA installation itself.
-