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

What are the steps to install mysql extension in php

王林
Release: 2023-03-07 07:02:02
Original
3563 people have browsed it

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
Copy after login

3. configure

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

4. Compile and install

make && make install
Copy after login

After this step, the system will prompt:

Installing shared extensions: /www/server/php/71/lib/php/extensions/no-debug-non-zts-20160303/
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template