0

After upgrading my ubuntu from 15.10 to 16.04 LTS, it is showing an error Your PHP installation appears to be missing the MySQL extension when taking any local website from my lamp.

When I tried to reinstall lamp, it shows the following error:

Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-core-5.7_5.7.12-0ubuntu1_amd64.deb
 /var/cache/apt/archives/mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Can any one help? Thanks in advance.

  • Just providing some more back ground info: The mysql i had used in 15.10 was exported from 14.04 while changing my laptop, and in 15.10 some time phpmyadmin used to show some errors and was not any major errors as i could work with it. Now i upgraded directly from 15.10 to 16.04 using upgrade option – AbuAbdillah May 2 '16 at 13:23
3

Just ran into the same error. You'll need to manually enable the mysqli php module and then restart apache:

$ sudo phpenmod mysqli
$ sudo service apache2 restart

After that, it all worked (for me).

  • tried, but not working for me. – AbuAbdillah May 18 '16 at 14:30
2

Ubuntu 16.04 includes PHP 7.0 that doesn't have old MySQL extension anymore as it has been deprecated for some time and removed in PHP 7.0. You either need to update your application to support MySQLi or pdo_mysql or install PHP 5.6 from PPA (ppa:ondrej/php).

As for the reinstallation problem, I would suggest removing MySQL packages first and then reinstalling them again:

sudo apt-get remove mysql-common
sudo apt-get install mysql-server
  • When i try it shows: You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: mysql-server : Depends: mysql-server-5.7 but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). – AbuAbdillah May 18 '16 at 19:44
  • So then when trying sudo apt-get install -f it shows: The following additional packages will be installed: mysql-server-5.7 mysql-server-core-5.7 Suggested packages: mailx tinyca The following NEW packages will be installed: mysql-server-5.7 mysql-server-core-5.7 0 upgraded, 2 newly installed, 0 to remove and 109 not upgraded. 1 not fully installed or removed. Need to get 0 B/10.1 MB of archives. After this operation, 94.4 MB of additional disk space will be used. Do you want to continue? [Y/n] – AbuAbdillah May 18 '16 at 19:51
  • Do you want to continue? [Y/n] y Preconfiguring packages ...... Preparing to unpack .../mysql-server-core-5.7_5.7.12-0ubuntu1_amd64.deb ... Unpacking mysql-server-core-5.7 (5.7.12-0ubuntu1) ... dpkg: error processing archive /var/cache/apt/archives/mysql-server-core-5.7_5.7.12-0ubuntu1_amd64.deb (--unpack): trying to overwrite '/usr/share/mysql/estonian/errmsg.sys', which is also in package mysql-common 5.7.12-1ubuntu15.10 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) Preparing to unpack .../mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb ... – AbuAbdillah May 18 '16 at 19:53
  • Unpacking mysql-server-5.7 (5.7.12-0ubuntu1) ... dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb (--unpack): trying to overwrite '/usr/share/mysql/errmsg-utf8.txt', which is also in package mysql-common 5.7.12-1ubuntu15.10 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe) – AbuAbdillah May 18 '16 at 19:55
  • Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Errors were encountered while processing: /var/cache/apt/archives/mysql-server-core-5.7_5.7.12-0ubuntu1_amd64.deb /var/cache/apt/archives/mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) – AbuAbdillah May 18 '16 at 19:56
1

When I upgraded my website PHP from version 5.6 to 7.2, I encountered this problem “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”. It turns out that mysql extension is no longer supported in php version 7.2. It is now using mysqli extention. I am using old version of wordpress which still using mysql extension that is why the problem existed. So what I did is upgraded the wordpress to the core. This solve the problem.

Here's the steps I followed when upgrading wordpress manually:

  1. First I created a full backup of my website http://fractioncalc.com. This is very important in case of mistake.
  2. I download the newest WordPress ZIP file from wordpress.org.
  3. I unzipped the file into a local directory of my computer.
  4. I went to my website root directory and deleted your ‘wp-includes’ and ‘wp-admin’ directories. I used sFTP connection using Filezilla software.
  5. I uploaded the new wp-includes and wp-admin directories from the new version of WordPress I unzipped to my website root directory and replaced the directories I just deleted.
  6. I did not delete the wp-content directory or any of the files in that directory. I just copied over the files from the wp-content directory in the new version of WordPress to my existing wp-content directory. All existing files with the same name have been overwritten.
  7. I copied all files from the root (‘/’) directory of the new version of WordPress that I unzipped into my website root directory (or the root directory of your WordPress installation). Existing files has been overwritten and new files has been copied across. wp-config.php file was not be affected because WordPress has never distributed with a wp-config.php file.
  8. I compare wp-config-sample.php which was distributed with WordPress, but did not find anything to change, so I just used the old one.
  9. I cleared my browser cache to ensure I can see all changes.
  10. I checked the site and there is no error now. Thanks God the upgrade was completed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.