PHP support Pdo_mysql in the CentOS environment

Source: Internet
Author: User
Tags zts zend

First, download the corresponding tgz package;
Http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
Second, the installation began

Extract
# tar ZXVF pdo_mysql-1.0.2.tgz

# CD pdo_mysql-1.0.2

Run command

#/usr/local/php/bin/phpize

Configuring for:
PHP Api version:20121212
Zend Module Api no:20060613
Zend Extension Api no:220060519

If you run/usr/local/php/bin/phpize, cannot find autoconf appears. Please check your autoconf installation and the
$PHP _autoconf environment variable. Then, rerun the this script. That means no autoconf.

then execute the command yum install M4

Yum Install autoconf

Configuration
./configure--with-php-config=/usr/local/php/bin/php-config--with-pdo-mysql=/usr/local/mysql

If you configure

If the execution times are wrong
Configure:warning:You would need re2c 0.12.0 or later if you want to regenerate PHP parsers.
Checking for gawk ... gawk
Checking for MySQL support for PDO ... yes, shared
Checking for mysql_config ... not found
Configure:error:Cannot find MySQL header files under
Workaround:
Cp/usr/local/mysql/bin/mysql_config/usr/bin

Compile
If the execution times are wrong
/pdo_mysql-1.0.2/php_pdo_mysql_int.h:25:19:error:mysql.h:no such file or directory
In file included from/software/pdo_mysql-1.0.2/pdo_mysql.c:31:
/pdo_mysql-1.0.2/php_pdo_mysql_int.h:36:error:expected specifier-qualifier-list before ' MYSQL '
/pdo_mysql-1.0.2/php_pdo_mysql_int.h:48:error:expected specifier-qualifier-list before ' MYSQL_FIELD '
/pdo_mysql-1.0.2/php_pdo_mysql_int.h:53:error:expected specifier-qualifier-list before ' MYSQL_RES '
Make: * * * [Pdo_mysql.lo] Error 1
Workaround:
Yum Install Mysql-devel

If a yum install Mysql-devel error persists, perform the following actions

This problem occurs because the file is required for MySQL header at compile time, and it does not find the location of the head file by default search. So to link the MySQL header file under the/usr/local/mysql/include/directory to/usr/local/include /In the directory:
Ln-s/usr/local/mysql/include/*/usr/local/include/

In general, after executing the above command, you should be able to compile the past. Then the make and make Install,pdo_mysql modules are added.



Third, modify the php.ini;
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20121212/" (no-debug-zts-20121212 the path name is set according to its actual situation)
Extension = "pdo_mysql.so"

Since then, the Pdo_mysql installation is complete.

http://blog.csdn.net/blueg2013/article/details/9307767

PHP support Pdo_mysql in the CentOS environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.