Home  >  Article  >  Backend Development  >  How to install mysql extension in php7

How to install mysql extension in php7

藏色散人
藏色散人Original
2021-09-19 11:17:514621browse

php7 How to install the mysql extension: 1. Download the mysql extension; 2. Execute "tar zxvf mysql.tar.gz"; 3. Enter the decompressed directory; 4. Add the mysql extension to the configuration file in php That’s it.

How to install mysql extension in php7

The operating environment of this article: Windows7 system, PHP7, Dell G3 computer.

How to install mysql extension in php7?

PHP7 completely removes Mysql extension support, and the original mysql_* series of functions will no longer be supported in mysql. As a result, the old project reported an error. Now install the extension and record it.

1. First download the mysql extension (http://git.php.net/?p=pecl/database/mysql.git)

2. Unzip

tar zxvf mysql.tar.gz

3. cd into the decompressed directory

phpize
./configure
make

A mysql.so file is generated in the modules directory.

4. Add mysql extension to php configuration file

# 首先打印出 phpinfo(), php的配置文件在这里
Loaded Configuration File   /etc/php/7.1/fpm/php.ini
sudo vim /etc/php/7.1/fpm/php.ini
# 添加一行
extension=/path/to/mysql.so
# 重启 php-fpm
sudo /etc/init.d/php7.1-fpm restart

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install mysql extension in php7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn