Home >Backend Development >PHP Tutorial >Detailed solution for installing PHP's pdo_mysql extension in Linux
PHP Data Objects (PDO) extension defines a lightweight and consistent interface for PHP to access the database. Each database driver that implements the PDO interface can expose database-specific features as standard extensions. Pay attention to using PDO The extension itself does not implement any database functionality; a database-specific PDO driver must be used to access database services. Document the installation process of the PDO MySQL extension.
2. PDO MySQL installation preparation
PDO_MYSQL-1.0.2.tgz
Download address: http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
Download address: http://pan.baidu.com/s/1c1NFTWO
3.PDO MySQL detailed installation configuration is as follows
PDO MYSQL separate installation and configuration process is as follows:
1、首次远程登录xshell进入root目录,把PDO_MYSQL-1.0.2.tgz上传到此目录。 2、解压文件 [root@localhost src]#tar zxvf PDO_MYSQL-1.0.2.tgz 3、配置和编译文件 [root@localhost src]cd PDO_MYSQL-1.0.2 [root@localhost MYSQL-1.0.2]/usr/local/php/bin/phpize [root@localhost MYSQL-1.0.2]./configure --with-php-c/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/ --with-zlib-dir=/usr/local/lib [root@localhost MYSQL-1.0.2]make [root@localhost MYSQL-1.0.2]make install 注: 我的PHP安装在 :/usr/local/php/ mysql 安装在 :/usr/local/mysql 编译的时候注意你自己的安装目录在哪里 # 切换目录,查看pdo_mysql.so是否存在 [root@localhost MYSQL-1.0.2]cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ 注: no-debug-non-zts-20060613生成的目录名是随机的 # 编辑php.ini 下载php.ini到本地编辑 # 添加pdo_mysql扩展 extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so 或者 extension=pdo_mysql.so # 重启apache或nginx
The above introduces the detailed solution for installing PHP's pdo_mysql extension in Linux, including the relevant aspects. I hope it will be helpful to friends who are interested in PHP tutorials.