One of the biggest changes relative to PHP5,PHP7 is the removal of the MySQL extension, the recommended use of mysqli or pdo_mysql, in fact, at the beginning of PHP5.5, PHP started to prepare to abandon the MySQL extension, if you use the MySQL extension, you may have seen such a hint " Deprecated:mysql_connect (): The MySQL extension is Deprecated and would be a removed in the Future:use mysqli or PDO Instea D in ". So in future programs, to maintain compatibility, try to minimize the use of MySQL extensions for database connections.
As OPS personnel, both want to use PHP7 to improve the efficiency of the server, but also to ensure that the old program can run, how to do it?
1. Go to PHP website to download MySQL extension, http://git.php.net/?p=pecl/database/mysql.git;a=summary
2. Unzip and initialize with the Phpize tool, compile:---package is
- #解压
- Tar xzvf mysql-45881bd.tar.gz
- #进入mysql扩展目录 from www.mfbuluo.com
- CD mysql-45881bd/
- #使用phpize初始化, my phpize in the/opt/directory.
- /opt/php/bin/phpize
- #编译mysql扩展, use MySQL native driver as the MySQL link library
- ./configure--with-php-config=/opt/php/bin/php-config--with-mysql=mysqlnd
- Make && make install
3. Next, we edit the php.ini file directly, copy the mysql.so to PHP.ini Extension_dir, and then add PHP.ini in extension=mysql.so
4. Restart PHP
After success, you can see the MySQL extension information with phpinfo:
Summary
Compared to PHP5, it is said that PHP7 has a great performance boost. If you are still using another version, you can upgrade to try.
How to install the MySQL extension in PHP7