1

I managed to find a PPA with php5.6 but when installed phpmyadmin from normal ubuntu packages, everything seemed to be fine until i visited 0.0.0.0/phpmyadmin. It said:

The mbstring extension is missing. Please check your PHP configuration.

Even tho I have uncommented it and restarted apache2, I still got this error which got me thinking which php.ini was phpmyadmin loading it from? Probably from a PHP 7.1 install that I don't even have so I want to ask how do I install phpmyadmin for PHP 5.6 in ubuntu 16.04 where PHP 5.6 doesn't apear in official packages anymore.

NOTE This is a fresh install of ubuntu-server 16.04.1 LTS using PPA of PHP 5.6

list of php installed packages:

root@*****:~# apt list --installed | grep php
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libapache2-mod-php5.6/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed]
php-common/xenial,xenial,now 1:49+deb.sury.org~xenial+4 all [installed,automatic]
php-phpseclib/xenial,xenial,now 2.0.1-1build1 all [installed,automatic]
php5.6/xenial,xenial,now 5.6.29-1+deb.sury.org~xenial+1 all [installed]
php5.6-cli/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed]
php5.6-common/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed,automatic]
php5.6-json/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed,automatic]
php5.6-mbstring/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed]
php5.6-mcrypt/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed]
php5.6-mysql/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed]
php5.6-opcache/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed,automatic]
php5.6-readline/xenial,now 5.6.29-1+deb.sury.org~xenial+1 amd64 [installed,automatic]
phpmyadmin/xenial-updates,xenial-updates,now 4:4.5.4.1-2ubuntu2 all [installed]
eye
  • 13
  • 4
  • What version of php are you using, and did you _enable_ `mbstring` in `apache`? – George Udosen Jan 19 '17 at 23:04
  • For mbstring extension, try this: `sudo apt-get install php5.6-mbstring`. – Sourav Badami Jan 19 '17 at 23:14
  • `php5.6-mbstring is already the newest version (5.6.29-1+deb.sury.org~xenial+1)` I think it's phpmyadmin that is trying to use php7 when it should use php5.6 (and find mbstring is installed) and I want to know if it's possible to change this – eye Jan 20 '17 at 00:56
  • this is a fresh install of ubuntu-server 16.04 LTS I didn't change anything, the only change I did was uncommenting the mbstring line in php.ini file, everything else is default – eye Jan 20 '17 at 00:58
  • 2
    Possible duplicate of [mbstring is missing for phpmyadmin in ubuntu 16.04](http://askubuntu.com/questions/772397/mbstring-is-missing-for-phpmyadmin-in-ubuntu-16-04) – David Foerster Jan 20 '17 at 10:56
  • it is not duplicate.. that solution is for php 7 now php 5.6 is not officially supported in ubuntu 16.04 so solutions from that will not work on this workaround, it's a special case – eye Jan 20 '17 at 17:05

1 Answers1

1

1. In /etc/php/x.x/apache2/php.ini has a line ;extension=php_mbstring.dll. In this case, this is just an example. Files with .dll extensions are libraries for Windows. Equivalent extensions for Ubuntu are .so - check your /etc/php/5.6/mods-available/mbstring.ini for example.

The easiest way to enable PHP modules in Ubuntu is through the command phpenmod. So you need:

sudo apt-get install php5.6-mbstring
sudo phpenmod mbstring 

2. To enable PHP 5.6 for Apache2 you need to:

  • Install the library:

    sudo apt install libapache2-mod-php5.6
    
  • Disable php7.x modules:

    sudo a2dismod php7.0 && sudo a2dismod php7.1
    
  • Enable php5.6 module:

    sudo a2enmod php5.6
    

3. Restart Apache2:

sudo systemctl restart apache2.service

4. Check your PHP configuration:

  • Create phpinfo.php file in /var/www/html/ (if this is your DocumentRoot Directory):

    echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
    
  • Open phpinfo.php in your web browser, and check your current PHP configuration: http://localhost/phpinfo.php.

pa4080
  • 29,351
  • 10
  • 85
  • 161