具体介绍Linux PHP5安装步骤
我们如何在Linux下安装PHP5呢?我们这里就详细的介绍一下Linux PHP5安装。服务器运行一段时间后,可能突然会需求添加某个扩展,如curl、pdo、xmlrpc等,这就需要在不重新编译PHP的情况下独立添加扩展。
下面以安装curl为例,介绍具体Linux PHP5安装步骤。
1.安装crul wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 ./configure --prefix=/usr/local/curl
make make install
2.编译生成扩展进入php源程序目录中的ext目录中,这里存放着各个扩展模块的源代码,选择你需要的模块,比如curl模块:
cd curl执行phpize生成编译文件,phpize在PHP安装目录的bin目录下/usr/local/php5/bin/phpize运行时,可能会报错:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.“,需要安装autoconf:yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux)生成配置文件,并编译生成模块:
/usr/local/php5/bin/phpize ./configure --with-curl=/usr/local/curl --with-php-config=/usr/local/php5/bin/php-config make make install
这样,curl.so就被复制到PHP对应目录(如:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/)
3.修改配置在php.ini里,设置扩展目录:
extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/"
并添加扩展模块引用:
extension = curl.so
4.检查并重启Apache
相关推荐
bluecarrot 2020-11-23
Attend 2020-11-17
ZHAICAN 2020-11-16
codedecode 2020-11-14
zhangbingb 2020-11-12
ykmail 2020-11-11
futurezone 2020-11-06
rikeyone 2020-11-04
橄榄 2020-11-04
WenCoo 2020-10-31
liuyuchen 2020-10-27
ROES 2020-10-24
Gexrior 2020-10-22
ZHAICAN 2020-10-20
风语者 2020-10-16
zhongguomin 2020-10-16
净无邪 2020-10-15