centos 6.5下编译安装php-7.1.6和 php memcached扩展
0,安装 php-7.1.6 依赖包
#yumgroupinstall"Developmenttools""DesktopPlatformDevelopment"#yum-yinstallopenssl-devellibcurl-devellibmcryptlibmcrypt-develbzip2-devel
1,编译安装php 7.1.6
## 如果需要加入 pgsql扩展 ,则必须先安装好 postgresql
#wgethttp://cn2.php.net/get/php-7.1.6.tar.gz/from/this/mirrorwgethttp://hk1.php.net/get/php-7.1.6.tar.gz/from/this/mirror#tarxfphp-7.1.6.tar.gz#cdphp-7.1.6#./configure--prefix=/usr/local/php-7.1.6\--with-config-file-path=/usr/local/php-7.1.6/etc--with-mysqli--with-pdo-mysql--with-pgsql=/usr/pgsql-9.4/\--with-pdo-pgsql=/usr/pgsql-9.4/--with-openssl\--with-zlib--with-bz2--with-gettext--with-curl\--with-gd--with-mhash--with-xmlrpc--with-mcrypt\--enable-xml--enable-bcmath--enable-shmop--enable-sysvsem--enable-fpm--enable-mbstring\--enable-pcntl--enable-sockets--enable-soap\--enable-calendar--enable-dba--enable-exif\--enable-ftp--with-freetype-dir--with-jpeg-dir--with-png-dir#make&&makeinstall
##在编译好的源码包目录下复制php的配置文件#cp/usr/local/src/php-7.1.6/php.ini-production/usr/local/php-7.1.6/etc/php.ini##复制php-fpm配置文件#cp/usr/local/php-7.1.6/etc/php-fpm.conf.default/usr/local/php-7.1.6/etc/php-fpm.conf##复制www配置文件#cp/usr/local/php-7.1.6/etc/php-fpm.d/www.conf.default/usr/local/php-7.1.6/etc/php-fpm.d/www.conf#vim/usr/local/php-7.1.6/etc/php-fpm.d/www.conf##修改php-fpm模块使用用户和组user=nginxgroup=nginx##在编译好的源码包目录下复制php-fpm启动脚本到/etc/init.d/#cp/usr/local/src/php-7.1.6/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm#chmod755/etc/rc.d/init.d/php-fpm#chkconfig--addphp-fpm#chkconfig--listphp-fpm#vim/etc/profile.d/php.sh##导出命令搜索路径到环境变量exportphp_home=/usr/local/php-7.1.6/bin/exportPATH=$PATH:$php_home#./etc/profile.d/php.sh
2,安装 memcached 缓存扩展
#yuminstallcyrus-saslcyrus-sasl-devel-y##memcached的依赖包#peclinstallmemcached##php-memcached扩展依赖库#wgethttps://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz#tarxflibmemcached-1.0.18.tar.gz#cdlibmemcached-1.0.18#./configure--prefix=/usr/local/libmemcached-1.0.18--with-memcached#make&&makeinstall##要使用pecl命令的前提是已经编译安装好的php中含有pear命令包,不过php-7.1.6中默认安装有pear#/usr/local/php-7.1.6/bin/peclinstallmemcached
libmemcached directory [no] : 填入刚才libmemcached的编译安装目录地址
##pecl命令安装完memcached后会提示你将memcached.so追加到php.ini配置文件中##在php配置中追加memcached模块#echo"extension=memcached.so">>/usr/local/php-7.1.6/etc/php.ini
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。