温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

yum安装的php如何添加模块

发布时间:2020-10-21 22:19:33 来源:网络 阅读:4115 作者:rong341233 栏目:web开发

环境说明:

操作系统: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服务即可

[root@CentOS5 ~]# php -m |grep libevent
libevent

下面是phpinfo()里的模块信息

yum安装的php如何添加模块


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
[root@CentOS5 ~]# php -m |grep pcntl
pcntl


如果在运行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.


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI