第一节 php环境搭建与优化

一 php安装

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

yum -y install libxml2yum -y install libxml2-develyum -y install opensslyum -y install openssl-develyum -y install curlyum -y install curl-develyum -y install libjpegyum -y install libjpeg-develyum -y install libpngyum -y install libpng-develyum -y install freetypeyum -y install freetype-develyum -y install pcreyum -y install pcre-develyum -y install libxsltyum -y install libxslt-develyum -y install bzip2yum -y install bzip2-devel[root@jweb-1 php-5.6.38]# useradd -s /sbin/nologin nginx[root@jweb-1 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[root@jweb-1 php-5.6.38]# make && make install[root@jweb-1 php-5.6.38]# cp php.ini-development /usr/local/php/lib/php.ini[root@jweb-1 php-5.6.38]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@jweb-1 php-5.6.38]#vim /usr/local/php/lib/php.ini 772 cgi.fix_pathinfo=0[root@jweb-1 php-5.6.38]# vim /usr/local/php/etc/php-fpm.conf149 user = nginx150 group = nginx[root@jweb-1 php-5.6.38]# vim /etc/profile 77 export PATH=/usr/local/php/bin/:$PATH[root@jweb-1 php-5.6.38]# php-fpm[root@jweb-1 php-5.6.38]# ss -tunlp | grep 9000tcp 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))[root@jweb-1 php-5.6.38]# vim /etc/rc.local/usr/local/bin/php-fpm[root@jweb-1 php-5.6.38]# chmod +x /etc/rc.local

二 安装php支持redis模块

[root@jweb-1 phpredis-2.2.4]# ls /usr/local/php/bin/php-config /usr/local/php/bin/php-config[root@jweb-1 phpredis-2.2.4]# ./configure --with-php-config=/usr/local/php/bin/php-config[root@jweb-1 phpredis-2.2.4]# make && make install[root@jweb-1 phpredis-2.2.4]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/opcache.a opcache.so redis.so[root@jweb-1 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"[root@jweb-1 ~]# php -m | grep redisredis

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

相关文章