今天在本机部署了一个pdo项目,发现一些问题,真没想到pdo mysql,不容易装啊,哈哈,我说的不容易,是因为php5.3以前版本,yum源里面根本没有。部署后就报,Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'。 1,从网上下pdo_mysql的扩展 下载地址:ht
今天在本机部署了一个pdo项目,发现一些问题,真没想到pdo mysql,不容易装啊,哈哈,我说的不容易,是因为php5.3以前版本,yum源里面根本没有。部署后就报,Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'。
1,从网上下pdo_mysql的扩展
下载地址:http://pecl.php.net/package/PDO_MYSQL
具体安装请参考:phpize增加php模块
不建议用这种方式安装,看官网说明
Do not use this, as PDO has been moved into core (the php source) so this pecl extension is dead.
This old extension provided a MySQL driver for PDO.
pdo的模块已经封装到php的核心代码里面去了,编译安装的时候,激活就行了。
./configure --with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock //mysql sock路径
2,yum安装pdo mysql
php我是用yum安装的,php版本是5.1的,当我安装pdo mysql的时候,报错
yum install php-pdo_mysql
报以下错误:php53-common conflicts with php-common
解决办法:把php-common卸载掉,装php53-common
yum remove php-common yum install php53-common php53 php53-pdo php-pdo_mysql
重起一下php-cgi就可以了。



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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)
