第一节 php环境搭建与优化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了第一节 php环境搭建与优化相关的知识,希望对你有一定的参考价值。

一 php安装
方法1 源码安装(jweb1,jweb2)

yum -y install libxml2
yum -y install libxml2-devel
yum -y install openssl
yum -y install openssl-devel
yum -y install curl
yum -y install curl-devel
yum -y install libjpeg
yum -y install libjpeg-devel
yum -y install libpng
yum -y install libpng-devel
yum -y install freetype
yum -y install freetype-devel
yum -y install pcre
yum -y install pcre-devel
yum -y install libxslt
yum -y install libxslt-devel
yum -y install bzip2
yum -y install bzip2-devel
[[email protected] php-5.6.38]# useradd -s /sbin/nologin nginx
[[email protected] php-5.6.38]# ./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
[[email protected] php-5.6.38]# make && make install
[[email protected] php-5.6.38]# cp php.ini-development /usr/local/php/lib/php.ini
[[email protected] php-5.6.38]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
 [[email protected] php-5.6.38]#vim /usr/local/php/lib/php.ini 
 772 cgi.fix_pathinfo=0
[[email protected] php-5.6.38]# vim /usr/local/php/etc/php-fpm.conf
149 user = nginx
150 group = nginx
[[email protected] php-5.6.38]# vim /etc/profile
 77 export PATH=/usr/local/php/bin/:$PATH
[[email protected] php-5.6.38]# php-fpm
[[email protected] php-5.6.38]# ss -tunlp | grep 9000
tcp    LISTEN     0      128    127.0.0.1:9000                  *:*                   users:(("php-fpm",pid=1047,fd=0),("php-fpm",pid=1046,fd=0),("php-fpm",pid=1045,fd=7))
[[email protected] php-5.6.38]# vim /etc/rc.local
/usr/local/bin/php-fpm
[[email protected] php-5.6.38]# chmod +x /etc/rc.local

二 安装php支持redis模块

[[email protected] phpredis-2.2.4]# ls /usr/local/php/bin/php-config 
/usr/local/php/bin/php-config
[[email protected] phpredis-2.2.4]# ./configure --with-php-config=/usr/local/php/bin/php-config
[[email protected] phpredis-2.2.4]# make && make install
[[email protected] phpredis-2.2.4]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
opcache.a  opcache.so  redis.so
[[email protected] phpredis-2.2.4]# vim /usr/local/php/lib/php.ini 
 733 extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-2013122     6/"
 734 extension = "redis.so"
[[email protected] ~]# php -m | grep redis
redis

三 php参数优化
优化参数参考:http://blog.51cto.com/11233559/2124007

以上是关于第一节 php环境搭建与优化的主要内容,如果未能解决你的问题,请参考以下文章

第一节 搭建开发环境

第一节:es6开发环境的搭建

萌新向Python数据分析及数据挖掘 第一章 Python基础 第一节 python安装以及环境搭建 第二节 变量和简单的数据类型

Angular最新教程-第一节环境搭建和新建项目

安卓学习第一节--环境搭建及Android Studio 安装

python笔记第一节--环境搭建