您的位置:首页 > 编程语言 > PHP开发

yum安装的php如何添加模块

2016-10-21 18:16 519 查看
环境说明:
操作系统:CentOS 5.11 x86_64
php版本:php 5.3.3(yum方式安装)

原来php安装过程:
yum -y install httpd php53 php53-bcmath php53-cli php53-common php53-dba php53-devel php53-gd php53-mbstring php53-xml php53-xmlrpc php53-snmp php53-mysql

现在因为项目原因需要安装libevent及pcntl和php-mcrypt,php-mcrypt的安装过程见 http://fengwan.blog.51cto.com/508652/1661548
1.php5.3.3安装libevent
yum -y install libevent-devel
wget
tar xf libevent-0.1.0.tgz
cd libevent-0.1.0
/usr/bin/phpize
./configure --enable-libevent --with-php-config=/usr/bin/php-config
make
make install
#之后就能见到
[root@CentOS5 libevent-0.1.0]# make install
Installing shared extensions: /usr/lib64/php/modules/

echo 'extension=libevent.so'>/etc/php.d/libevent.ini
如果只安装libevent就足够的话,这个时候重新启动httpd服务即可
2.php 5.3.3安装pcntl
pcntl目前存在于php-5.3.3.tar.gz的源码中,需要我们去官网下载源码。
wget http://museum.php.net/php5/php-5.3.3.tar.gz cd php-5.3.3/ext/pcntl
/usr/bin/phpize
./configure --enable-pcntl --with-php-config=/usr/bin/php-config
make
make install
echo 'extension=pcntl.so' >/etc/php.d/pcntl.ini
#重新启动httpd
如果在运行php -m |grep pcntl的时候出现
PHP Warning: Module 'pcntl' already loaded in Unknown on line 0
则可能是出现了重复加载pcntl的情况,则将刚才的/etc/php.d/pcntl.ini删除,重新启动即可。
3.php 5.3.3安装phar并下载phpunit作为测试工具
wget http://museum.php.net/php5/php-5.3.3.tar.gz yum -y install pcre-devel
#phar需要使用pcre模块
cd php-5.3.3/ext/phar
/usr/bin/phpize
./configure --enable-phar --with-php-config=/usr/bin/php-config
make
make install
echo 'extension=phar.so' >/etc/php.d/phar.ini
如果你安装suhosin模块,则需要
修改/etc/php.d/suhosin.ini这行为
suhosin.executor.include.whitelist = phar
如果有设置php.ini的open_basedir则需要注释掉,防止出现各种问题
下载phpunit
wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit
phpunit --version
PHPUnit 4.7.7 by Sebastian Bergmann and contributors.

本文出自 “枫林晚” 博客,请务必保留此出处http://fengwan.blog.51cto.com/508652/1675645
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息