简单介绍一下,如何在CentOS上安装PHP5.6。
配置yum源
追加CentOS 6.5的epel及remi源。
#rpm-Uvhhttp://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm#rpm-Uvhhttp://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7.0的源。
#yuminstallepel-release #rpm-ivhhttp://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
#yumlist--enablerepo=remi--enablerepo=remi-php56|grepphp
安装PHP5.6
yum源配置好了,下一步就安装PHP5.6。
#yuminstall--enablerepo=remi--enablerepo=remi-php56phpphp-opcachephp-develphp-mbstringphp-mcryptphp-mysqlndphp-phpunit-PHPUnitphp-pecl-xdebugphp-pecl-xhprof
用PHP命令查看版本。
#php--version PHP5.6.0(cli)(built:Sep3201419:51:31) Copyright(c)1997-2014ThePHPGroup ZendEnginev2.6.0,Copyright(c)1998-2014ZendTechnologies withZendOPcachev7.0.4-dev,Copyright(c)1999-2014,byZendTechnologies withXdebugv2.2.5,Copyright(c)2002-2014,byDerickRethans
在这里安装的版本是PHP5.6.0,细心的用户可能已经发现ZendGuardLoader变成Zend OPcahe了。
对从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。
补充:可用此方式进行PHP升级。
——————————————————
./configure –prefix=/usr/local/php –with-config-file-path=/etc –enable-fpm –enable-pcntl –enable-mysqlnd –enable-opcache –enable-sockets –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-shmop –enable-zip –enable-ftp –enable-soap –enable-xml –enable-mbstring –disable-rpath –disable-debug –disable-fileinfo –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-pcre-regex –with-iconv –with-zlib –with-mcrypt –with-gd –with-openssl –with-mhash –with-xmlrpc –with-curl –with-imap-ssl
./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –with-http_ssl_module –http-client-body-temp-path=/var/lib/nginx/tmp/client_body –http-proxy-temp-path=/var/lib/nginx/tmp/proxy –http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi –pid-path=/var/run/nginx.pid –lock-path=/var/lock/subsys/nginx
rpm -ivh libpng libpng-devel
yum install –enablerepo=remi –enablerepo=remi-php56 php-fpmphp-cliphp-processphp-develphp-pearphp-memcached php-mysql
#/usr/sbin/php-fpm
# ps -aux |grep php
server {
listen 80;
server_name ip;
root html;
index index.php index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_index index.php;
}
}
————————————
https://pkgs.org/ 下载rpm包
只下载php相关连的包不安装,要先装yum-plugin-downloadonly包
#rpm -ivh yum-plugin-downloadonly-1.1.30-30.el6_6.lux.1.noarch.rpm
yum install –downloadonly –downloaddir=/tmp/ php