今天正好用空把php环境升级到5.6版本,首先我之前的环境是源码包编译的lnmp环境
首先到php官方网站上下载一个php5.6的tar包,放到机器上面后,开始安装,安装前先将nginx,mysql,php-fpm都关掉,
然后将/usr/local/php这个目录删除或者改名
> tar -zxf php-5.6.8.tar.gz >cd php-5.6.8 >./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext ##编译完成后,开始安装 >make ZEND_EXTRA_LIBS=‘-liconv‘ >make install
等安装完成后就差不多可以了,然后将配置文件拷贝好,
>cp php.ini-production /usr/local/php/etc/php.ini >cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
将/usr/local/php/etc/php-fpm.conf编辑成如下 pid = /usr/local/php/var/run/php-fpm.pid error_log = /usr/local/php/var/log/php-fpm.log log_level = notice [www] listen = /tmp/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 20 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 6 request_terminate_timeout = 100 request_slowlog_timeout = 0 slowlog = var/log/slow.log //nginx中的配置也要对应匹配行啊 location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; }
将各个服务都重新启动,就ok啦
时间: 2024-11-07 19:41:04