Home  >  Article  >  Backend Development  >  What are the steps to install mysql extension in php

What are the steps to install mysql extension in php

王林
王林Original
2020-11-03 15:38:393480browse

The steps for php to install the mysql extension are: 1. Download the mysql extension and unzip it; 2. Initialize using the phpize tool; 3. Configure; 4. Compile and install; 5. Edit the php.ini configuration file and add [ extension=pdo_mysql.so]; 6. Restart the service.

What are the steps to install mysql extension in php

The specific steps are as follows:

(Video tutorial recommendation: php video tutorial)

1 , download the mysql extension

2. Unzip it and use the phpize tool to initialize it (phpize is usually under the PHP installation directory /bin/) and execute it in the folder after the extension is decompressed

/www/server/php/71/bin/phpize

3. configure

./configure --with-php-config=/www/server/php/71/bin/php-config

4. Compile and install

make && make install

After this step, 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:

What are the steps to install mysql extension in php

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.

Tip: If you modify extension_dir, you need to copy the mysql.so file to the corresponding path.

Related recommendations: php training

The above is the detailed content of What are the steps to install mysql extension in php. 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