不影响原有PHP的情况下安装新版本的php (5.5.20)
admin
2023-06-26 20:22:09
0
  1. 安装依赖包。

    yum install gcc httpd-devel libxml2-devel openssl-devel pcre-devel bzip2-devel gmp-devel autoconf curl-devel libxslt-devel libpng-devel postgresql-devel sqlite-devel libmemcached libmemcached-devel gcc-c++ unixODBC-devel   pcre-devel gmp gmp-devel  libxslt-devel libjpeg-turbo-devel freetype-devel -y

  2. 下载php源码包

    wget http://cn2.php.net/distributions/php-5.5.20.tar.gz


  3. 编译php源码包

  Shell#cd /usr/local/src

  Shell#wget http://cn2.php.net/distributions/php-5.5.20.tar.gz

  Shell#tar -zxvf php-5.5.20.tar.gz

  Shell#cd php-5.5.20

  Shell#./configure --prefix=/usr/local/php5520 --with-config-file-path=/usr/local/php5520/etc  --with-config-file-scan-dir=/usr/local/php5520/etc/php.d  --with-libdir=lib64  --disable-debug --with-pic --disable-rpath --without-pear --with-bz2  --with-freetype-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr --enable-gd-native-ttf --without-gdbm --with-gettext --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-exif --enable-ftp  --enable-sockets --enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-kerberos --enable-shmop --enable-calendar --enable-xml --without-mysql --without-gd --disable-dom --disable-dba --without-unixODBC --disable-pdo --disable-xmlreader --disable-xmlwriter --without-sqlite3 --disable-phar --disable-fileinfo --disable-json --without-pspell --disable-wddx --without-curl --disable-posix --disable-sysvmsg --disable-sysvshm --disable-sysvsem  --enable-fpm --with-mysql=shared,mysqlnd --enable-opcache

  Shell#make && make install


4. 装额外模块(其他模块按照这个模式安装)

  Shell#cd /usr/local/src/php-5.5.20/ext/bcmath

  Shell#/usr/local/php5520/bin/phpize

  Shell#./configure --with-php-config=/usr/local/php5520/bin/php-config

  Shell#make (这一步能够看见生成的bcmath.so的路径)

  Shell#make install

  Shell#vim /usr/local/php5520/etc/php.d/bcmath.ini

  ##########添加

  extension=bcmath.so

  ##########


 

  Shell#cd /usr/local/src/php-5.5.20/ext/gd

  Shell#/usr/local/php5520/bin/phpize

  Shell#./configure --with-php-config=/usr/local/php5520/bin/php-config --with-freetype-dir=/usr/ --with-jpeg-dir=/usr/

  Shell#make && make install

  Shell#vim /usr/local/php5520/etc/php.d/gd.ini

  ##########添加

  extension=gd.so

  ##########


  Shell#rpm -ivh  ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm 

  Shell#rpm -ivh ftp://rpmfind.net/linux/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm

  Shell#cd /usr/local/src/php-5.5.20/ext/mcrypt

  Shell#/usr/local/php5520/bin/phpize

  Shell#./configure --with-php-config=/usr/local/php5520/bin/php-config

  Shell#make && make install

  Shell#vim /usr/local/php5520/etc/php.d/mcrypt.ini

  ##########添加

  extension=mcrypt.so

  ##########

    

  #php的缓存模块,对性能提高比较大

  Shell#cd /usr/local/src/php-5.5.20/ext/opcache

  Shell#/usr/local/php5520/bin/phpize

  Shell#./configure --with-php-config=/usr/local/php5520/bin/php-config

  Shell#make && make install

  Shell#vim /usr/local/php5520/etc/php.d/opcache.ini

  ##########添加

  zend_extension=opcache.so

  opcache.fast_shutdown=1

  opcache.enable_cli=1

  opcache.enable=on

  opcache.memory_consumption=128

  opcache.interned_strings_buffer=8

  opcache.max_accelerated_files=4000

  opcache.revalidate_freq=30

  ##########



5. 配置启动php-fpm

  拷贝php-fpm的启动文件

  Shell#cp -a /usr/local/src/php-5.5.20/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

  Shell#chmod +x /etc/rc.d/init.d/php-fpm

  Shell#/etc/init.d/php-fpm start


 

6. 配置文件说明。

  安装为此之后,php和php-fpm 的配置文件都在 /usr/local/php5520/etc 目录下。

相关内容

热门资讯

探秘“城市生命线”背后,上海国... 来源:滚动播报 (来源:上观新闻) 906公里运营线路长度、工作日日均客流量达1100万乘次——庞...
美国防长香会讲话:对华降调维稳... 【文/观察者网 王一】第23届香格里拉对话会5月29日至31日在新加坡举行。该会议由英国国际战略研究...
OPPO Reno16 Pro... 对于预算在4000元左右,正在寻找一款高性价比的学生党、大学生或高三毕业生来说,市面上琳琅满目的机型...
中科创达副总裁杨新辉:推动传统... 本报记者 袁传玺 5月29日下午,2026证券市场年会行业分会数字经济大会在北京举行。此次大会由《证...
重庆:将人工智能深度嵌入科研全... 中国教育报-中国教育新闻网讯(记者 杨国良)5月28日,2026年重庆市教育科研工作会议传出新信号:...
“罕见会晤”,美国与古巴两军高... 据凤凰卫视报道,美军南方司令部5月29日在社交平台发布消息和相片,指南方司令部司令多诺万,当天在位于...
美民调:超半数美国人称生活成本... 据凤凰卫视报道,美国政治新闻网5月29日公布的最新民调显示,美国选民仍然不满意总统特朗普的经济政策,...
燃气灶开关无法控制怎么办 燃气灶开关无法控制,这是一种非常危险的情况。这种情况可能会导致燃气泄漏和火灾等严重后果。如果您遇到这...
为什么海尔冰箱冷冻室温度显示一... 这种情况表示的是超温报警灯亮了。也就是说冰箱的冷冻室温度没有降下去,冷冻室温度降到零下8度左右就自动...
西门子冰箱冷冻室温度一直闪烁是... 1、有可能是因为操作不当导致的情况;2、有可能是西门子冰箱显示屏的供电电源或显示屏本身的故障。 ...