Home>Article>Backend Development> How to compile and install php mysql

How to compile and install php mysql

藏色散人
藏色散人 Original
2022-01-24 10:05:24 2391browse

How to compile and install mysql with php: 1. Enter the pdo_mysql directory of the php source code package installation path; 2. Run phpize; 3. Run config and specify the location of the mysql and php directories; 4. Compile and install to generate mysql. so; 5. Add the mysql.so extension configuration.

How to compile and install php mysql

The operating environment of this article: linux5.9.8 system, PHP7.1 version, DELL G3 computer

How to compile and install mysql with php?

PHP compile and install the extension of mysql.so

1. Enter the pdo_mysql directory of the php source code package installation path

/usr/local/src/php/package/php-5.6.29/ext/pdo_mysql

2. Run phpize, generate a configure file in this directory

/usr/local/php/bin/phpize

3. Run config, specify the mysql and php directory locations

./configure --prefix=/data/php --with-pdo-mysql=/data/mysql/bin/mysql_config --with-php-config=/data/php/bin/php-config --with-zlib-dir=/root/php-5.6.25/ext/zlib

4. Compile and install, generate mysql.so

make && make install

5. Modify the php.ini file, add the mysql.so extension configuration, save and exit

vim /data/php/etc/php.ini extension=pdo_mysql.so

6. Restart php-fpm

service php-fpm restart

7. Test, add the php file in the web directory, For example, /data/nginx/html/mysql.php


      

Access URL, such as: http://ip/mysql.php

If ok is displayed, the configuration is successful

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to compile and install php mysql. 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