ShuDudu's Home was started in 2011, but the web data is lost, so now begin again, I would like to make some friends, I hope you like ShuDudu's home.
Current position: ShuDudu > Net Web >

LAMP/LNMP pure original development schedule (4): MySQL pit

Saturday on February 8th, 2020Net Web

LAMP, LNMP has been completed in Debian, Ubuntu, CentOS versions of the development, installation package to solve the various systems installed at each error. Only a thin MySQL installation, commissioning, each PHP project I developed beginning in 2009, did not use MySQL.

This time use MySQL, because the installation package must have this function; in addition, the development of VPS panel, need to back up MySQL. So, I had to learn as quickly as possible, skilled MySQL installation, commissioning and backup.

Install MySQL, the best way is to practice installing Wordpress. I remember a few years ago, I would once every few years to install Wordpress, follow the steps in each written by someone else online tutorials are successfully installed on Linux hosts. As the installation process is relatively smooth, it is not difficult, so every time there is no record, but shortly afterwards completely forgotten.

The installation of Wordpress, but encountered a pit, the problem took more than a day until resolved. Total Tip: Your PHP MySQL extension does not seem necessary for running WordPress installation.

In the Baidu search for a solution, search for a long time, finally found a complete installation tutorial Wordpress. Through the success of the installation process, I found the cause of the problem.

The reason this occurs is very special, because now is the latest version of Wordpress, it must be installed in PHP 5.6, and I was using third-party software source remi install PHP 5.6.40. Since the initial commissioning, the first skilled environment in PHP 5.6.

This error message appears, because there is no MySQL extension. The solution is, CentOS system: yum -y install php-mysql

(Debian, Ubuntu not tested.)

I installed remi + PHP 5.6, and then install yum -y install php-mysql. Then there is always an error.

CentOS 6.7 this error:

Error: Package: php-pdo-5.3.3-49.el6.i686 (base)

Requires: php-common (x86-32) = 5.3.3-49.el6

Installed: php-common-5.6.40-13.el6.remi.i686 (@ remi-php56)

php-common (x86-32) = 5.6.40-13.el6.remi

Available: php-common-5.3.3-49.el6.i686 (base)

php-common (x86-32) = 5.3.3-49.el6

Error: Package: php-mysql-5.3.3-49.el6.i686 (base)

Requires: php-common (x86-32) = 5.3.3-49.el6

Installed: php-common-5.6.40-13.el6.remi.i686 (@ remi-php56)

php-common (x86-32) = 5.6.40-13.el6.remi

Available: php-common-5.3.3-49.el6.i686 (base)

php-common (x86-32) = 5.3.3-49.el6

CentOS 7.6.1810 this error:

Error: Package: php-pdo-5.4.16-46.el7.x86_64 (base)

Requires: php-common (x86-64) = 5.4.16-46.el7

Installed: php-common-5.6.40-13.el7.remi.x86_64 (@ remi-php56)

php-common (x86-64) = 5.6.40-13.el7.remi

Available: php-common-5.4.16-46.el7.x86_64 (base)

php-common (x86-64) = 5.4.16-46.el7

Appears above error, because that comes with source PHP CentOS 6.7 version is 5.3.3, CentOS comes with source PHP 7.6.1810 version is 5.4.16. By installing a third-party software source PHP 5.6.40, when you install php-mysql, it still will look for source PHP comes with built-relevant documents, instead of looking for PHP 5.6.40 relevant documents.

So try a variety of solutions, method of compiling MySQL extension to install too complex, because of the need to first download the Linux version of PHP 5.6.40 installation package, and then compile msql.so or mysql.so.

If this approach can succeed, then the development of LAMP/LNMP's installation package from the PHP 5.4-5.6, PHP 7.0-7.4 Each version requires a corresponding compile these .so files.

Finally, try to use deceitful methods, installation smoothly.

Before installing PHP, MySQL install expansion, command: yum -y install php-mysql

Then install the httpd or Nginx, php, mysql-server, the command: yum -y install httpd mysql-server

(PHP is installed by remi PHP 5.6, or PHP 7.X, the command is omitted)

In this way, the successful installation of MySQL extensions, Wordpress also make the installation!

The principle of these software installed, it is in a debugging environment, once successful, the same steps ported to other systems, but also relatively smooth and successful, except that part of the command being given different.

Wordpress installation is successful today in CentOS 6, CentOS 7 + PHP 5.6. The next step is in PHP 7, Nginx, Debian, Ubuntu environment under installation.

The reason being given in this article describes, simply put, is that if it is built with PHP source system, this error does not occur. Once you change the default version of PHP, you must install the MySQL extension, and then install high-PHP version, otherwise it will error. This error, due to a bug in php-mysql.

2019-10-05 14:43 UPDATE:

PHP 5.6 CentOS install third-party source software, PHP MySQL extension can not be installed after 7 solution 2: uninstall PHP 5.X or PHP 7.X, the command:

a1 = `rpm -qa | grep php`; b1 = ($ {a1 // /}); for a2 in $ {b1 [@]}; do yum -y remove $ a2; done;

After you install the MySQL extension, then install PHP.

Copyright Protection: ShuDudu from the original article, reproduced Please keep the link: https://www.shududu.com/netweb/LAMP-LNMP-pure-original-development-schedule-4-MySQL-pit.htm