php升级

从php5.3升级到目前最新的php7.1.5

1.下载最新的php的源码,切换到源码目录中:

(1)编译

./configure 
--prefix=/alidata/server/php7 
--with-config-file-scan-dir=/usr/local/php/etc/ 
--enable-inline-optimization 
--enable-opcache 
--enable-session 
--enable-fpm 
--with-mysql=mysqlnd 
--with-mysqli=mysqlnd 
--with-pdo-mysql=mysqlnd 
--with-pdo-sqlite 
--with-sqlite3 
--with-gettext 
--enable-mbregex 
--enable-mbstring 
--enable-xml 
--with-iconv 
--with-mcrypt 
--with-mhash 
--with-openssl 
--enable-bcmath 
--enable-soap 
--with-xmlrpc 
--with-libxml-dir 
--enable-pcntl 
--enable-shmop 
--enable-sysvmsg 
--enable-sysvsem 
--enable-sysvshm 
--enable-sockets 
--with-curl 
--with-curlwrappers 
--with-zlib 
--enable-zip 
--with-bz2 
--with-gd 
--enable-gd-native-ttf 
--with-jpeg-dir 
--with-png-dir  
--with-iconv-dir 
--with-readline 
--with-iconv=/usr/local/libiconv

如果复制上面的代码,注意将其放在一行运行。如果运行报错了,可google,应该是一些类库没有安装或者目录指定不对。

其中指定了安装的路径:

/alidata/server/php7   

此时这个目录是空的。

(2)make && make install

 

2.安装成功之后,再看php7目录里的东西

bin  etc  include  lib  php  sbin  var  

 

nginx关联php,先看nginx这块关联的代码,在nginx的配置文件的server块里

 location ~ .*\.(php|php5)?$
        {
                #fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                include fastcgi.conf;
        }  

这个是php-fpm来管理的,先去停掉原来的php5的php-fpm,然后开启新安装的php7的php-fpm.

那么新安装的php7的php-fpm如何启动呢?

切换到上面新安装的php7的sbin目录里:

./php-fpm  

报错如下

[23-May-2017 23:24:51] WARNING: Nothing matches the include pattern '/alidata/server/php7/etc/php-fpm.d/*.conf' from /alidata/server/php7/etc/php-fpm.conf at line 125.
[23-May-2017 23:24:51] ERROR: No pool defined. at least one pool section must be specified in config file
[23-May-2017 23:24:51] ERROR: failed to post process the configuration
[23-May-2017 23:24:51] ERROR: FPM initialization failed  

解决办法

php-fpm.d]# cp www.conf.default www.conf   

在www.conf做相应的配置。

启动php-fpm,升级成功。

 

 

   

posted @ 2017-05-24 00:15  skytree  阅读(383)  评论(0)    收藏  举报