CentOs環境下PHP支援PDO_MYSQL

來源:互聯網
上載者:User

標籤:

一、下載相應tgz包;
 http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
二、安裝開始

解壓
# tar zxvf PDO_MYSQL-1.0.2.tgz 

# cd PDO_MYSQL-1.0.2

運行命令

# /usr/local/php/bin/phpize 

Configuring for:
PHP Api Version:         20121212
Zend Module Api No:      20060613
Zend Extension Api No:   220060519

 

如果運行/usr/local/php/bin/phpize 出現Cannot find autoconf. Please check your autoconf installation and the 
$PHP_AUTOCONF environment variable. Then, rerun this script. 那麼說明沒有autoconf

 

那麼執行命令 yum install m4  

                 yum install autoconf

 

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

如果配置

如果執行時報錯
configure: warning: You will 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 
解決辦法:
cp /usr/local/mysql/bin/mysql_config /usr/bin

 

編譯
如果執行時報錯
/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
解決辦法:
yum install mysql-devel

如果執行yum install mysql-devel錯誤仍然存在,那麼執行如下操作

這是因為在編譯時間需要mysql的頭的檔案,而它按預設搜尋找不到標頭檔的位置,所以才出現這個問題.所以要將 /usr/local/mysql/include/ 目錄下的mysql標頭檔連結到 /usr/local/include/ 的目錄下:
ln -s /usr/local/mysql/include/* /usr/local/include/

 

一般來說,執行完上面的命令後,應該能編譯過去 。然後再make和make install,pdo_mysql模組加進去了



三、修改php.ini; 
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20121212/"(no-debug-zts-20121212 該路徑名根據自己的實際情況設定)
extension = "pdo_mysql.so"

自此,PDO_MYSQL安裝完成。

 

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

CentOs環境下PHP支援PDO_MYSQL

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.