更新一下,之前写的是安装7.0,现在可以安装7.2了,参考链接:
https://webtatic.com/packages/php72/
直接更新php70为php72
yum install yum-plugin-replace yum replace php-common --replace-with=php72w-common
It will likely give you a message “WARNING: Unable to resolve all providers …“. This is normal, and you can continue by tying “y”. You will be given a chance to see what packages will be installed and removed before again being given a chance to confirm.
这两天又装了一下虚拟机,又要编译lnmp,还要弄各种拓展,很麻烦,能不能直接yum安装呢?答案是可以的!
1、首先要更新yum源,不然肯定是老版本,一般都在5.6及以下,但是php7都出来好久了,性能提升50%以上!
按照系统更新yum源,我的是centos7,所以我运行下面的代码!
CentOS/RHEL 7.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果是centos6,那么执行以下代码:
CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
然后就可以直接yum安装php7.0了,可以安装的拓展如下:
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel
就这一条命令,就可以安装了下面的拓展了!
php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
激动吧?别急,还有更牛的!一般都要安装memcached,gd,mysql,等等是吧?
安装包 提供的拓展
php70w mod_php , php70w-zts
php70w-bcmath
php70w-cli php-cgi, php-pcntl, php-readline
php70w-common php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml , php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php70w-dba
php70w-devel
php70w-embedded php-embedded-devel
php70w-enchant
php70w-fpm
php70w-gd
php70w-imap
php70w-interbase php_database, php-firebird
php70w-intl
php70w-ldap
php70w-mbstring
php70w-mcrypt
php70w-mysql php-mysqli, php_database
php70w-mysqlnd php-mysqli, php_database
php70w-odbc php-pdo_odbc, php_database
php70w-opcache php70w-pecl-zendopcache
php70w-pdo php70w-pdo_sqlite, php70w-sqlite3
php70w-pdo_dblib php70w-mssql
php70w-pear
php70w-pecl-apcu
php70w-pecl-imagick
php70w-pecl-memcached
php70w-pecl-mongodb
php70w-pecl-redis
php70w-pecl-xdebug
php70w-pgsql php-pdo_pgsql, php_database
php70w-phpdbg
php70w-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php70w-pspell
php70w-recode
php70w-snmp
php70w-soap
php70w-tidy
php70w-xml php-dom, php-domxml, php-wddx, php-xsl
php70w-xmlrpc
譬如你要加装xml,那么可以直接,别怀疑就是这么简单:
yum install php70w-xml
2、检验一下成果:
查看一下php版本:
php -v
查看一下php拓展:
php -m
看到了吧?基本上会用的拓展都齐了吧?要啥自己去yum一下就好了!再也不用去纠结各种依赖问题了!
使用国内yum源:http://blog.csdn.net/zhezhebie/article/details/73484695
安装redis和memcached,直接yum安装即可:
yum install -y memcached redis
memcached说明: http://blog.csdn.net/zhezhebie/article/details/73471519
redis说明: http://blog.csdn.net/zhezhebie/article/details/73470134
到这里还没结束,还需要配置一下php的配置文件和nginx的配置文件。
参考链接:http://php.net/manual/en/install.unix.nginx.php
webtatic参考链接:https://webtatic.com/packages/php70/
配置php解析.php文件:
http://php.net/manual/en/install.unix.nginx.php