linux php添加扩展库

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux php添加扩展库相关的知识,希望对你有一定的参考价值。

CentOS_7.2编译安装PHP_5.6.20添加扩展模块

添加ZendGuardLoader扩展:

# 解压ZendGuardLoader.so到"/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/"目录内

chmod a+x /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ZendGuardLoader.so
vim /etc/php.ini


# 添加
[ZendGuardLoader]
extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/ZendGuardLoader.so"zend_loader.enable = 1zend_loader.disable_licensing = 0zend_loader.obfuscation_level_support = 3


service php-fpm restart

 

 

添加Redis扩展:


tar zxvf phpredis-2.2.7.tgz
rm -rvf package.xml
mv redis-2.2.7/ /usr/local/php/include/php/ext/redis/cd /usr/local/php/include/php/ext/redis/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install


vim /etc/php.ini
=
service php-fpm restart

 

 

添加MemCache扩展:


tar zxvf phpmemcache-3.0.8.tgz
rm -rvf package.xml
mv memcache-3.0.8/ /usr/local/php/include/php/ext/memcache/cd /usr/local/php/include/php/ext/memcache/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install


vim /etc/php.ini
=
service php-fpm restart

 

 

添加MemCached扩展:


tar zxvf phpmemcached-2.2.0.tgz
rm -rvf package.xml
mv memcached-2.2.0/ /usr/local/php/include/php/ext/memcached/cd /usr/local/php/include/php/ext/memcached/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached/ --enable-memcached
make
make install


vim /etc/php.ini
# 添加
[MemCached]
extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/memcached.so"
service php-fpm restart

 

 

添加Imagick扩展:


tar zxvf phpimagick-3.4.0.tgz
rm -rvf package.xml
mv imagick-3.4.0/ /usr/local/php/include/php/ext/imagick/cd /usr/local/php/include/php/ext/imagick/
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick
make
make install


vim /etc/php.ini
# 添加
[Imagick]
extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/imagick.so"
service php-fpm restart

 

 

添加Xcache扩展:


tar zxvf phpxcache-3.2.0.tar.gz
mv xcache-3.2.0/ /usr/local/php/include/php/ext/xcache
cd /usr/local/php/include/php/ext/xcache/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer
make
make install



mkdir -p /home/xcache
touch /home/xcache/xcache
chmod 777 /home/xcache/xcache
echo -n "xcache-Passw0rd!" | md5sum
cp -r /usr/local/php/include/php/ext/xcache/htdocs/ /home/www/html/xcache
chown www:www -R /home/www/html/xcache/


vim /etc/php.ini


# 添加
[Xcache]
extension = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so"xcache.shm_scheme = "mmap"xcache.size = 26M
xcache.count = 5 xcache.slots = 8K
xcache.ttl = 3600xcache.gc_interval = 300xcache.var_size = 4M
xcache.var_count = 5 xcache.var_slots = 8K
xcache.var_ttl = 0xcache.var_maxttl = 0xcache.var_gc_interval = 300xcache.test = Off
xcache.readonly_protection = Off
xcache.mmap_path = "/home/xcache/xcache"xcache.coredump_directory = ""xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off
[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "admin"xcache.admin.pass = "42ddb5e3f0dc3c4807a2b0c62b8d4d87"[xcache.coverager]
xcache.coverager = Off
xcache.coverager_autostart = On
xcache.coveragedump_directory = ""



本文出自 “梦想照进现实” 博客,请务必保留此出处http://lookingdream.blog.51cto.com/5177800/1861611

以上是关于linux php添加扩展库的主要内容,如果未能解决你的问题,请参考以下文章

开发函数计算的正确姿势———为 PHP 运行时添加自定义扩展

Linux下安装PHP的lua扩展库

linux-php5.6-安装sftp扩展

php 动态添加扩展

#yyds干货盘点#Linux下增加php对curl扩展的支持

宝塔面板在安装PHP的时候,很多扩展库是没有安装的,于是,我们需要自己安装这个扩展库,用于让自己的代码更好的运行