How to install the pdo_mysql extension in php: 1. Download the source code package of the pdo_mysql extension and unzip it; 2. Execute phpize to generate the makefile; 3. Open the php.ini configuration file; 4. Modify the php extension path and open [ extension=pdo_mysql.so].
Specific steps:
(Learning video recommendation: php video tutorial)
Download first The source code package of pdo_mysql extension. You can use wget to download directly to the server
# wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
and then decompress it.
# tar -zxvf PDO_MYSQL-1.0.2.tgz
Enter the decompressed directory and execute phpize.
# /usr/local/php/bin/phpize Configuring for: PHP Api Version: 20100412 Zend Module Api No: 20100525 Zend Extension Api No: 220100525
The next two parameters generated in the makefile
must be added. I did not add them at the beginning, but the result was that the header files of php-config and mysql could not be found.
# ./configure –with-php-config=/usr/local/php/bin/php-config –with-pdo-mysql=/usr/local/mysql
Before making, you need to make a soft connection to the mysql header file. Because the directory is specified when MySQL is installed, the header file will still not be found without making a soft connection.
# ln -s /usr/local/mysql/include/* /usr/local/include/
Then make and make install
# make # make install
(recommended related tutorials: php graphic tutorial)
will prompt you As follows, it means that the extension is installed in the following directory.
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
For convenience, I moved the pdo_mysql.so file to the extensions directory
# mv /usr/local/php/lib/php/extensions/no-debug-zts-20100525/pdo_mysql.so /usr/local/php/lib/php/extensions/
Then you can modify the php.ini file.
Find the line; extension_dir = “./”, remove the comment, and modify the path.
extension_dir = “/usr/local/php/lib/php/extensions/”
After testing here, it was found that php will only look for the extension so from this directory, but not the subdirectories under this directory. So before, I moved all so files to this directory for unified management.
Find the line; extension=php_pdo_mysql.dll, remove the comment, and modify the following file name.
extension=pdo_mysql.so
The file names are different. You need to remove the php_ prefix here, otherwise the file cannot be found. The following dll is the file name under windows, we change it to so.
Finally just restart apache. Use phpinfo() to check and find that it has taken effect.
The above is the detailed content of How to install pdo_mysql extension in php. For more information, please follow other related articles on the PHP Chinese website!

The article compares ACID and BASE database models, detailing their characteristics and appropriate use cases. ACID prioritizes data integrity and consistency, suitable for financial and e-commerce applications, while BASE focuses on availability and

The article discusses securing PHP file uploads to prevent vulnerabilities like code injection. It focuses on file type validation, secure storage, and error handling to enhance application security.

Article discusses best practices for PHP input validation to enhance security, focusing on techniques like using built-in functions, whitelist approach, and server-side validation.

The article discusses strategies for implementing API rate limiting in PHP, including algorithms like Token Bucket and Leaky Bucket, and using libraries like symfony/rate-limiter. It also covers monitoring, dynamically adjusting rate limits, and hand

The article discusses the benefits of using password_hash and password_verify in PHP for securing passwords. The main argument is that these functions enhance password protection through automatic salt generation, strong hashing algorithms, and secur

The article discusses OWASP Top 10 vulnerabilities in PHP and mitigation strategies. Key issues include injection, broken authentication, and XSS, with recommended tools for monitoring and securing PHP applications.

The article discusses strategies to prevent XSS attacks in PHP, focusing on input sanitization, output encoding, and using security-enhancing libraries and frameworks.

The article discusses the use of interfaces and abstract classes in PHP, focusing on when to use each. Interfaces define a contract without implementation, suitable for unrelated classes and multiple inheritance. Abstract classes provide common funct


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment