Home  >  Article  >  Backend Development  >  How to install mysqli in php7

How to install mysqli in php7

藏色散人
藏色散人Original
2021-11-26 09:56:314282browse

How to install mysqli in php7: 1. Install the mysqli extension through make install; 2. Find the path to php.ini through phpinfo; 3. Uncomment php_mysqi.dll.

How to install mysqli in php7

The operating environment of this article: Windows7 system, php-7.1.5, Dell G3.

php7 How to install mysqli?

centos php7 Installation experience of mysqli extension

When I configured the new server, I found that php could not Connect to mysql. Discovered via phpinfo. The relevant configuration of mysqli is not displayed at all. After a series of studies. Summarized. :

Step one:

There is no mysqli configuration in phpinfo because there is no configure mysqli when installing php7

Installation method of php: wget http://cn2.php .net/distributions/php-7.1.5.tar.gz

tar zxvf php-7.1.5.tar.gz
cd php-7.1.5
./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/bin/mysql_config             
注:/usr/bin/mysql_config   这个路径为自己的mysql_config路径   可通过 find -name mysql_config查找
make && make install        
cp  php.ini-development /usr/local/lib/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm
chmod +x /etc/init.d/php7-fpm
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf
/etc/init.d/php7-fpm  start 启动php

After installation, you will find that phpinfo has mysqli

Step 2: Install the mysqli extension

Method:

cd /usr/local/php-7.1.5/ext/mysqli   //到php文件ext下的mysqli
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/bin/mysql_config

Note: usr/bin/mysql_config path is the same as the first step method

make
make test
make install

Now there should be a mysqli extension

The third step :

Modify php.ini

Find the path to php.ini through phpinfo. Modify php.ini. Uncomment php_mysqi.dll

End!

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install mysqli 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