0

I was using PHP 4.0 and recently upgraded to PHP 7.0 with cPanel. But now my website is down, it shows the following error: Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

Does this mean that I will have to completely reinstall & reconfigure all websites, or is there an easy solution within cPanel?

-- snip --

Undo
  • 25,519
  • 37
  • 106
  • 129
Nk nk nk
  • 23
  • 1
  • 1
  • 6
  • 8
    mysql_* functions are deprecated as of PHP 5.5.0, and removed as of PHP 7.0.0. Switch your code to use [PDO](https://secure.php.net/manual/en/pdo.prepared-statements.php) or [mysqli](http://php.net/manual/en/mysqli.quickstart.prepared-statements.php) instead. Since you're using Wordpress, try upgrading your Wordpress installation or switch your config to use PDO or Mysqli – aynber Jan 23 '18 at 15:17
  • please write down the code to see what is the problem with buhehe.de – Ofek S. Jan 23 '18 at 15:20
  • What must i find in wp-config? – Nk nk nk Jan 23 '18 at 15:20
  • What code do u mean? I use wordpress. Which code should i provide? – Nk nk nk Jan 23 '18 at 15:22
  • What version of WordPress are you using? – aynber Jan 23 '18 at 15:25
  • 2
    Possible duplicate of [Php7 Installation of wordpress on nginx throwing PHP installation missing MySQL extension which is required by WordPress](https://stackoverflow.com/questions/41200180/php7-installation-of-wordpress-on-nginx-throwing-php-installation-missing-mysql) – aynber Jan 23 '18 at 15:29
  • WordPress 4.9.2 – Nk nk nk Jan 23 '18 at 15:29
  • But how can i do it in cpanel? sudo apt-get install php-mysqlnd php-mysqli sudo /etc/init.d/php7.0-fpm restart – Nk nk nk Jan 23 '18 at 15:29
  • https://stackoverflow.com/questions/31662519/how-to-install-mysqli-on-a-cpanel-managed-server – aynber Jan 23 '18 at 15:30
  • Alternatively switch to PHP 5.6 - and start preparing for PHP 7.1; both 5.6 and 7.0 leave support completely in December but you should have fewer compatibility issues with 5.6, buying you the time to migrate. – CD001 Jan 23 '18 at 15:40
  • 6
    @NikaKhachidze before doing anything else. I would recommend changing ALL your passwords. They have just been leaked to the world. – Matt Smeets Jan 23 '18 at 15:54

1 Answers1

3

PHP 4? Wow :-P

All the mysql_whatever() commands have been deprecated a while back , and completely removed in v7 (see http://php.net/manual/en/migration70.removed-exts-sapis.php).

You should now update your code to use the PDO API.

http://php.net/manual/en/class.pdo.php

See this guide for steps involved.

https://www.sitepoint.com/migrate-from-the-mysql-extension-to-pdo/

You may have other things needing fixed too. Always check the changelogs, and look at these migration guides, which lists everything you need to know about the upgrade.

http://php.net/manual/en/migration5.php

http://php.net/manual/en/migration70.php

Your wordpress should be able to update itself by clicking something in the admin section. I can't remember specifically, but here's a link that can help. You just need to worry about the code you wrote yourself.

https://codex.wordpress.org/Updating_WordPress

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39
  • Don't forget the fact that he is using Wordpress, this means that he will not be doing any scripting himself. Better to link an upgrade/migration manual for WordPress – Matt Smeets Jan 23 '18 at 16:01
  • wordpress is able to update itself, he only needs to worry about the code he and his team wroite – delboy1978uk Jan 23 '18 at 16:02
  • Yes but this error indicates he is using an old version of WordPress on PHP 7.0 – Matt Smeets Jan 23 '18 at 16:03
  • This is why self-hosting WordPress is almost always a terrible idea. Unless you're prepared to patch WordPress, PHP, and the server itself on a regular and *emergency basis* you're going to get into trouble. There's many high-quality WordPress providers out there at various price-points. Most will keep your installation and back-end patched and secure as part of that package. – tadman Jan 23 '18 at 16:56
  • I like *using* wordpress, but as a developer I have to say the code looks like it was written in 2003, and unfortunately this encourages devs to code in a similarly atrocious manner. It doesn't surprise me at all when they run into trouble. – delboy1978uk Jan 23 '18 at 16:58