Home php教程 php手册 linux php pdo mysql 扩展

linux php pdo mysql 扩展

Jun 06, 2016 pm 08:09 PM
linux mysql pdo php Expand local machine

今天在本机部署了一个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路径
Copy after login

2,yum安装pdo mysql

php我是用yum安装的,php版本是5.1的,当我安装pdo mysql的时候,报错

yum install php-pdo_mysql
Copy after login

报以下错误:php53-common conflicts with php-common

解决办法:把php-common卸载掉,装php53-common

yum remove php-common
yum install php53-common php53 php53-pdo php-pdo_mysql
Copy after login

重起一下php-cgi就可以了。

linux php pdo mysql 扩展 今天在本机部署了一个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就可以了。linux php pdo mysql 扩展
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Apr 01, 2025 pm 03:06 PM

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? The page is blank after PHP is connected to MySQL. What is the reason for the invalid die() function? Apr 01, 2025 pm 03:03 PM

The page is blank after PHP connects to MySQL, and the reason why die() function fails. When learning the connection between PHP and MySQL database, you often encounter some confusing things...

How to solve the permissions problem encountered when viewing Python version in Linux terminal? How to solve the permissions problem encountered when viewing Python version in Linux terminal? Apr 01, 2025 pm 05:09 PM

Solution to permission issues when viewing Python version in Linux terminal When you try to view Python version in Linux terminal, enter python...

How to efficiently integrate Node.js or Python services under LAMP architecture? How to efficiently integrate Node.js or Python services under LAMP architecture? Apr 01, 2025 pm 02:48 PM

Many website developers face the problem of integrating Node.js or Python services under the LAMP architecture: the existing LAMP (Linux Apache MySQL PHP) architecture website needs...

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

Can the Python interpreter be deleted in Linux system? Can the Python interpreter be deleted in Linux system? Apr 02, 2025 am 07:00 AM

Regarding the problem of removing the Python interpreter that comes with Linux systems, many Linux distributions will preinstall the Python interpreter when installed, and it does not use the package manager...

How to configure apscheduler timing task as a service on macOS? How to configure apscheduler timing task as a service on macOS? Apr 01, 2025 pm 06:09 PM

Configure the apscheduler timing task as a service on macOS platform, if you want to configure the apscheduler timing task as a service, similar to ngin...

How to solve permission issues when using python --version command in Linux terminal? How to solve permission issues when using python --version command in Linux terminal? Apr 02, 2025 am 06:36 AM

Using python in Linux terminal...

See all articles