• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

php 升级php5.5 、php7

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm

yum install php55w php55w-opcache

yum install yum-plugin-replace
yum replace php-common --replace-with=php55w-common
相关包:
php55w php55w-bcmath php55w-cli php55w-common php55w-dba php55w-devel php55w-embedded php55w-enchant php55w-fpm   php55w-gd php55w-imap php55w-interbase php55w-intl php55w-ldap php55w-mbstring php55w-mcrypt php55w-mssql php55w-mysql php55w-mysqlnd php55w-odbc php55w-opcache php55w-pdo php55w-pecl-memcache php55w-pecl-xdebug php55w-pgsql php55w-process php55w-pspell php55w-recode php55w-snmp php55w-soap php55w-tidy php55w-xml php55w-xmlrpc
 
先下载php7
wget http://cn2.php.net/get/php-7.0.2.tar.gz/from/this/mirror
解压下载下来的文件
tar -zxvf php-7.1.0.tar.gz 

卸载之前php

yum remove php
rpm -qa|grep php  //php相关列表
rpm -e php-cli-5.4.16-42.el7.x86_64    //逐一删除

安装前准备支持

yum install libxmal2 libxml2-devel openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel

configure

./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip

Error:

checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for cc... no
checking for gcc... no
configure: error: in `/home/cloud-user/php-7.1.0\':
configure: error: no acceptable C compiler found in $PATH
See `config.log\' for more details

需要install gcc

yum install gcc

configure

./configure --prefix=/usr/local/php --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip

出现错误,解决方案

  1)freetype.h not fount  =>  yum install freetype-devel

  2)onfigure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/  =>  yum install curl curl-devel

  3)cannot find openssl\'s<evp.h>  =>  yum install openssl openssl-devel

  4)configure error xml2-config not found. please check your libxml2 installation  =>  yum install libxml2 libxml2-devel

  5)png.h not found.  =>  yum install libpng-devel

 

make && make install时间较长

make && make install

配置相应文件

cp php.ini-development /usr/local/php/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/php-fpm /usr/local/bin

设置php.ini

vi /usr/local/php/php.ini
打开php配置文件找到cgi.fix_pathinfo配置项,这一项默认被注释并且值为1,根据官方文档的说明,这里为了当文件不存在时,阻止Nginx将请求发送到后端的PHP-FPM模块,从而避免恶意脚本注入的攻击,所以此项应该去掉注释并设置为0

修改php-fpm

然后网上一些教程说让修改php-fpm.conf添加以上创建的用户和组,
find / -name php-fpm.conf
vim ....php-fpm.conf

修改

默认情况下etc/php-fpm.d/下有一个名为www.conf.defalut的配置用户的文件,执行下面命令复制一个新文件并且打开:
cp www.conf.default www.conf vi www.conf
默认user和group的设置为nobody,将其改为合适的。

启动php-fpm

/usr/local/bin/php-fpm

 php-fpm服务默认使用9000端口,使用 netstat -tln | grep 9000 可以查看端口使用情况:

yum install参考网址:http://www.centoscn.com/image-text/install/2015/1222/6560.html 

更新静项原

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm  

Error

epel-release >= 7 被 webtatic-release-7-3.noarch 需要

解决

yum install epel-release

yum install 

yum install php70w php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mssql php70w-mysql php70w-odbc php70w-opcache php70w-pdo php70w-pecl-memcache php70w-pecl-xdebug php70w-pgsql php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc

 nginx支持php,安装php时一定需要带php-fpm

先启动php-fpm

/usr/sbin/php-fpm

修改nginx.conf

        location ~ \.php$ {
                fastcgi_pass 127.0.0.1:9000;#php-fpm的默认端口是9000
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

重启nginx 

systemctl restart nginx

写个phpinfo浏览器访问就可以:

 

 

或者:

 

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm //升级本地镜像源,可能会失败,多试几次

yum install 

yum install php70w php70w-bcmath php70w-cli php70w-common php70w-dba php70w-devel php70w-embedded php70w-enchant php70w-fpm php70w-gd php70w-imap php70w-interbase php70w-intl php70w-ldap php70w-mbstring php70w-mcrypt php70w-mssql php70w-mysql php70w-odbc php70w-opcache php70w-pdo php70w-pecl-memcache php70w-pecl-xdebug php70w-pgsql php70w-process php70w-pspell php70w-recode php70w-snmp php70w-soap php70w-tidy php70w-xml php70w-xmlrpc

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
069-PHP数组下标发布时间:2022-07-10
下一篇:
PHP中双冒号::的用法发布时间:2022-07-10
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap