1、常用命令
查看编译参数:php -I
查看加载模块:php -m
查看模块详情:php --ri 模块名
2、redis扩展
tar xf redis-4.2.0.tgz \
&& cd redis-4.2.0 \
&& /opt/php/bin/phpize \
&& ./configure --with-php-config=/opt/php/bin/php-config \
&& make -j2 \
&& make install
echo "extension= redis.so" >> /opt/php/etc/php.ini
3、fileinfo扩展
tar xf php-5.6.31.tar.bz2
cd php-5.6.31/ext/fileinfo/
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make && make install
echo "extension=fileinfo.so" >>/opt/php/etc/php.ini
systemctl restart php-fpm
4、memcached扩展
wget https://launchpadlibrarian.net/165454254/libmemcached-1.0.18.tar.gz
tar xf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/opt/libmemcached --with-memcached
make -j2 &&make install
wget http://pecl.php.net/get/memcached-2.2.0.tgz
tar xf memcached-2.2.0.tgz
cd memcached-2.2.0
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config --with-libmemcached-dir=/opt/libmemcached/ --disable-memcached-sasl
make -j2 && make install
echo "extension=memcached.so" >> /opt/php/etc/php.ini
systemctl restart php-fpm
5、memcache扩展
wget http://pecl.php.net/get/memcache-3.0.8.tgz
cd memcache-3.0.8.tgz
cd memcache
/opt/php/bin/phpize
./configure --enable-memcache --with-php-config=/opt/php/bin/php-config --with-zlib-dir
make -j2 && make install
# 配置php
echo "extension=/opt/php/lib/php/extensions/no-debug-non-zts-20131226/ memcache.so" >> /opt/php/etc/php.ini
6、Zend opcache扩展
wget http://pecl.php.net/get/zendopcache-7.0.5.tgz
tar zxvf zendopcache-7.0.5.tgz
cd zendopcache-7.0.5
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make && make install
echo "extension=opcache.so" >> /opt/php/etc/php.ini
systemctl restart php-fpm
7、swoole扩展
wget http://pecl.php.net/get/swoole-1.9.3.tgz
tar -zvxf swoole-1.9.3.tgz
cd swoole-1.9.3
/opt/php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make && make install
echo "extension=swoole.so" >>/opt/php/etc/php.ini
systemctl restart php-fpm
8、imagick扩展
tar -xzvf ImageMagick.tar.gz
cd ImageMagick-7.0.2-0
./configure --prefix=/opt/imagemagick
make && make install
/opt/php/bin/pecl install imagick
cp -a imagick.so /opt/php/lib/php/extensions/no-debug-non-zts-20131226 文件拷贝到/Data/app/php5.6.26/lib/php/extensions/no-debug-non-zts-20131226下
echo "extension=imagick.so"" >>/opt/php/etc/php.ini
systemctl restart php-fpm
9、mbstring扩展
cd /usr/local/src/php-5.6.24/ext/mbstring
/opt//php/bin/phpize
./configure --with-php-config=/opt/php/bin/php-config
make && make install
echo "mbstring.internal_encoding = UTF-8" >> /opt/php/etc/php.ini
echo "extension=mbstring.so" >>/opt/php/etc/php.ini
systemctl restart php-fpm
10、mysql扩展
tar -zxvf PDO_MYSQL-1.0.2.tgz
/opt/php/bin/phpize
./configure --with-php-config=/optl/php/bin/php-config --with-pdo-mysql=/opt/mysql
ln -s /opt/mysql/include/* /usr/local/include/
make && make install
echo "extension=pdo_mysql.s" >> /opt/php/etc/php.ini
systemctl restart php-fpm
11、ionCube扩展
tar xf ioncube_loaders_lin_x86-64.tar.bz2 \
&& cd ioncube \
&& cp -a ioncube_loader_lin_5.6.so /opt/php/lib/php/extensions/no-debug-non-zts-20131226 \
&& cat >> /opt/php/etc/php.ini <<EOF
zend_extension = /opt/php/lib/php/extensions/no-debug-non-zts-20131226/ ioncube_loader_lin_5.6.so
EOF
12、ZendGuardLoader扩展
tar xf zend-loader-php5.6-linux-x86_64_update1.tar.gz \
&& cd zend-loader-php5.6-linux-x86_64 \
&& cp -a ZendGuardLoader.so /opt/php/lib/php/extensions/no-debug-non-zts-20131226/
cat >> /opt/php/etc/php.ini <<EOF
zend_extension=/opt/php/lib/php/extensions/no-debug-non-zts-20131226/ ZendGuardLoader.so
zend_extension=/opt/php/lib/php/extensions/no-debug-non-zts-20131226/ opcache.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
EOF
11、event扩展
# 安装libevent库
wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz tar -zxvf libevent-2.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=/usr/local/libevent-2.1.11
make && make install
wget http://pecl.php.net/get/event-2.5.3.tgz tar -zxvf event-2.5.3.tgz
cd event-2.5.3 /www/server/php/72/bin/phpize
./configure --with-php-config=/usr/local/src/php/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.11
make && make install
echo "extension=event.so" >> /opt/php/etc/php.ini
标签:opt,php,&&,tar,--,make,模块,PHP5.6,安装
From: https://blog.51cto.com/zzzhao/6164752