安装pdo.so和pdo_mysql.so还有pcntl.so扩展到php中

时间:2022-10-23 09:55:59

1、下载源码,解压tar -xzvf php-5.4.20.tar.gz

cd  /usr/local/src/php-5.4.20/ext/pdo

/usr/local/php/bin/phpize
./configure -with-php-config=/usr/local/php/bin/php-config -enable-pdo=shared
make
make test
make install
 
cd  /usr/local/src/php-5.4.20/ext/pdo_mysql
/usr/local/php/bin/phpize
 ./configure -with-php-config=/usr/local/php/bin/php-config -with-pdo-mysql=/usr/local/mysql
make
make test
make install
 

[hubo@test15169x /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525]$ ll
总计 2.9M
-rwxr-xr-x 1 hubo hubo 155K 10-16 21:26 pdo_mysql.so
-rwxr-xr-x 1 hubo hubo 317K 10-16 21:18 pdo.so

 

vim  /usr/local/etc/cgi/php.ini
;extension = "pdo.so"
extension = "pdo_mysql.so"
 
只需要打开extension = "pdo_mysql.so"扩展即可,否则会报PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
 
 
 
安装pcntl扩展时,make时 报错  link: `pcntl.lo' is not a valid libtool object
make clean 后没有问题了
 
cd /usr/local/src/php-5.4.12/ext/pcntl/
 /usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config

make
make clean

make

make install

Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/