Memcache客户端安装配置(3)

#php版本:5.6.31 #安装依赖包 [root@memcached ~]# yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel xml2 xml2-devel openssl openssl-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl libcurl-devel gdbm-devel db4-devel libXpm libXpm-devel libX11 libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel #编译安装libmcrypt库, [root@memcached ~]# cd /usr/local/src/ [root@memcached src]# wget [root@memcached src]# tar -zxvf libmcrypt-2.5.8.tar.gz [root@memcached src]# cd libmcrypt-2.5.8 [root@memcached libmcrypt-2.5.8]# ./configure [root@memcached libmcrypt-2.5.8]# make [root@memcached libmcrypt-2.5.8]# make install #编译安装php [root@memcached ~]# cd /usr/local/src/ [root@memcached src]# wget [root@memcached src]# tar -jxvf php-5.6.31.tar.bz2 [root@memcached src]# cd php-5.6.31 [root@memcached php-5.6.31]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-MySQL --with-pdo-mysql --with-mysqli --with-openssl --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-mhash --with-mcrypt --with-bz2 --enable-zip --with-curl --with-gettext --with-iconv --with-xmlrpc --enable-fpm --enable-sockets --enable-sysvshm --enable-mbstring --enable-pdo --enable-libxml --enable-xml --enable-soap --enable-session --enable-ctype --enable-ftp --enable-bcmath --enable-shmop --enable-inline-optimization --enable-opcache --enable-mbregex --enable-pcntl --enable-cgi --enable-wddx [root@memcached php-5.6.31]# make [root@memcached php-5.6.31]# make install #php.ini文件 [root@memcached ~]# cp /usr/local/src/php-5.6.31/php.ini-production /usr/local/php/etc/php.ini [root@memcached ~]# ln -s /usr/local/php/etc/php.ini /etc/php.ini #php-fpm.conf文件,取消”;pid = run/php-fpm.pid”的注释,同时修改运行账号通nginx服务的运行账号一致 [root@memcached ~]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@memcached ~]# ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf [root@memcached ~]# sed -i 's|;pid = run/php-fpm.pid|pid = run/php-fpm.pid|g' /usr/local/php/etc/php-fpm.conf [root@memcached etc]# sed -i 's|user = nobody|user = www|g' /usr/local/php/etc/php-fpm.conf [root@memcached etc]# sed -i 's|group = nobody|group = www|g' /usr/local/php/etc/php-fpm.conf #设置开机启动 [root@memcached ~]# cp /usr/local/src/php-5.6.31/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm [root@memcached ~]# chown www:www /etc/rc.d/init.d/php-fpm [root@memcached ~]# chmod 755 /etc/rc.d/init.d/php-fpm [root@memcached ~]# chkconfig --level 35 php-fpm on #设置nginx支持php [root@memcached ~]# vim /usr/local/nginx/conf/nginx.conf #第2行,取消user的注释,修改运行账号为www www,与/usr/local/php/etc/php-fpm.d/www.conf中的user/group配置一致 user www www; #第45行,添加index.php index index.html index.htm index.php; #第65~71行,取消FastCGI server部分location的注释;注意fastcgi_param行的参数,改为$document_root$fastcgi_script_name,或者使用绝对路径 #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } #验证测试 [root@memcached ~]# echo -e "<?php\nphpinfo();\n?>" > /usr/local/nginx/html/index.php [root@memcached ~]# chown -R www:www /usr/local/nginx/html/ [root@memcached ~]# chmod -R 700 /usr/local/nginx/html/ [root@memcached ~]# service nginx restart [root@memcached ~]# service php-fpm start 

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

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