Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install the extension of mysql in PHP7

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

One of the biggest changes from PHP5,PHP7 is the removal of the MySQL extension. It is recommended to use mysqli or pdo_mysql. In fact, starting with PHP5.5, PHP begins to prepare to abandon the mysql extension. If you use the mysql extension, you may have seen the prompt "Deprecated: mysql_connect (): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in". Therefore, in future programs, in order to maintain compatibility, we should minimize the use of mysql extensions for database connections.

As an operation and maintenance staff, not only want to use PHP7 to improve the efficiency of the server, but also to ensure that the old programs can run, how to do?

1. Download the mysql extension, http://Git.php.NET/?p=pecl/database/mysql.git;a=summary, on the php website

two。 Extract and initialize using the phpize tool, compile:

# decompression

Tar xzvf mysql-45881bd.tar.gz

# enter the mysql extension directory from www.mfbuluo.com

Cd mysql-45881bd/

# initialize using phpize, and my phpize is in / opt/ directory

/ opt/php/bin/phpize

# compile the mysql extension and 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 the extension_dir of php.ini, and then add extension=mysql.so to the php.ini

4. Restart php

After success, you can see the information of the mysql extension with phpinfo:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report