Home > Backend Development > PHP Tutorial > Linux下手动编译安装PHP扩展的例子分享_PHP

Linux下手动编译安装PHP扩展的例子分享_PHP

WBOY
Release: 2016-06-01 11:51:55
Original
1220 people have browsed it

开发和部署的过程中可能会经常出现需要额外安装PHP扩展的情况,下边以PDO_MYSQL为例,介绍下手动编译安装PHP扩展:

先到http://pecl.php.net/找需要的版本,我用的是稳定的版本。要先看看说明,特别是要注意mysql的php的版本。
复制代码 代码如下:
wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar xzvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
./configure –with-php-config=/usr/local/php/bin/php-config

经过configure就可以make了
复制代码 代码如下:
make
make install

注意pdo_mysql的全路径,我的是:
复制代码 代码如下:
/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so

然后在/usr/local/lib/php.ini

加上一句:
复制代码 代码如下:
extension=/usr/local/php/lib/php/extensions/debug-non-zts-20060613/pdo_mysql.so

重新启动apache即可看到已经加载pdo_mysql成功。

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template