5.6.4+扩展安装+安全配置+性能配置(2)

# vim /etc/profile export PHP_HOME=/usr/local/php export PATH=$PATH:$PHP_HOME/bin:$PHP_HOME/sbin $ source /etc/profile $ php -version PHP 5.6.4 (cli) (built: Jan 3 2015 11:16:17) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

然后复制默认的配置文件:

# cp /usr/local/src/php-5.6.4/php.ini-production /usr/local/php-5.6.4/etc/php.ini # cp /usr/local/php-5.6.4/etc/php-fpm.conf.default /usr/local/php-5.6.4/etc/php-fpm.conf

接下来修改默认配置文件:

# vim /usr/local/php/etc/php.ini date.timezone = Asia/Shanghai # vim /usr/local/php/etc/php-fpm.conf [global] pid = /usr/local/php-5.6.4/var/run/php-fpm.pid error_log = /usr/local/php-5.6.4/var/log/php-fpm.log log_level = error [www] user = www group = www listen = 127.0.0.1:9000 listen.owner = www listen.group = www listen.mode = 0666

添加启动脚本,之后可以使用service来启动php-fpm程序,并且设置开机自启动:

# cp /usr/local/src/php-5.6.4/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm # chmod +x /etc/init.d/php-fpm # service php-fpm Usage: /etc/init.d/php-fpm {start|stop|force-quit|restart|reload|status}
# chkconfig php-fpm on

启动php-fpm:

# service php-fpm start Starting php-fpm done

如果启动的时候出现错误(实际操作中发现存在该情况):

Starting php-fpm /usr/local/php-5.6.4/sbin/php-fpm: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory failed

则将MySQL的so库文件copy到系统下:

# cp /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/

再来重新启动PHP,这次启动成功。

#PHP+Nginx#

现在来编辑nginx.conf以支持php解析,查看当前php环境是否可以正常运行:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c781dd319f4f444323cca15555e687aa.html