Home>Article>Backend Development> What is the method to install mysql extension in php7
How to install mysql extension in php7: 1. Download the mysql extension and unzip it; 2. Use the phpize tool to initialize and configure; 3. Execute the [make && make install] command; 4. Edit the php.ini file; 5. Restart the service.
Environment of this article: windows10 system, php7, Dell G3 computer. This article applies to all brands of computers.
The specific installation steps are as follows:
(Related recommendations:php video tutorial)
1. Download the mysql extension
http://git.php.net/?p=pecl/database/mysql.git;a=summary
2 , decompress and initialize using the phpize tool (phpize is generally under the PHP installation directory /bin/)
Execute /www/server/php/71/bin/phpize
in the folder after the extension is decompressed.3. Configure
./configure --with-php-config=/www/server/php/71/bin/php-config
4. make && make install
After this step is completed, the system will prompt:
Installing shared extensions: /www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/
The mysql.so we want is in this path.
This path is also the default extension_dir:
PHP default extension_dir path
5. Modify php.ini
Add a line in the php.ini file:
extension=pdo_mysql.so
Save and restart the service.
If you modify extension_dir, you need to copy the mysql.so file to the corresponding path.
Related recommendations:Programming Video
The above is the detailed content of What is the method to install mysql extension in php7. For more information, please follow other related articles on the PHP Chinese website!