1. Download the mysql extension from the php website
2. Unzip it, initialize it using the phpize tool, and compile the file package.
# tar xzvf mysql-45881bd.tar.gz
3. Enter the mysql extension directory
# cd mysql-45881bd/
4. Use phpize to initialize and place phpize in the /opt/ directory.
# /opt/php/bin/phpize
5. Edit the php.ini file directly, copy mysql.so to the current directory of php.ini, and then add extension=mysql.so in php.ini.
# cp /root/mysql-fae9884/modules/mysql.so /etc/
6. Restart php.
# /etc/init.d/php-fpm restart Gracefully shutting down php-fpm . done Starting php-fpm done
When we use PHP, we usually configure some modules, and the functions that come with it are far from enough. Mysql is our commonly used database, and its extension module can be used in PHP.
The above is the detailed content of How to install the mysql extension module in php. For more information, please follow other related articles on the PHP Chinese website!