安装依赖
#解压PHP软件,进行编译安装,将程序安装到/application目录中,并且创建软链接#安装其它相关依赖程序---libmcrypt wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repoyum -y install libmcrypt-devel mhash mcryptrpm -qa libmcrypt-devel mhash mcrypt http://php.net/releases/yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel -yyum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -yrpm -qa zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel curl-devel freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel
安装PHP软件程序
tar xf php-5.5.32.tar.gz cd php-5.5.32 #----正式编译前也可以把这个软件安装上(libxslt*) ./configure --prefix=/application/php-5.5.32 \--with-mysql=mysqlnd \--with-pdo-mysql=mysqlnd \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-zlib \--with-libxml-dir=/usr \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-fpm \--enable-mbstring \--with-mcrypt \--with-gd \--enable-gd-native-ttf \--with-openssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-soap \--enable-short-tags \--enable-static \--with-xsl \--with-fpm-user=www \--with-fpm-group=www \--enable-ftp \--enable-opcache=no##提示 如下内容 即成功Generating filesconfigure: creating ./config.statuscreating main/internal_functions.ccreating main/internal_functions_cli.c+--------------------------------------------------------------------+| License: || This software is subject to the PHP License, available in this || distribution in the file LICENSE. By continuing this installation || process, you are bound by the terms of this license agreement. || If you do not agree with the terms of this license, you must abort || the installation process at this point. |+--------------------------------------------------------------------+
[root@web01 php-5.5.32]# make install
[root@web01 php-5.5.32]# echo $?0
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ #可以不创建 touch ext/phar/phar.phar make && make install ln -s /application/php-5.5.32/ /application/php#复制php.ini配置文件[root@web01 php-5.5.32]# cp /home/lewen/tools/php-5.5.32/php.ini-production /application/php-5.5.32/lib/php.ini#复制php-fpm配置文件[root@web01 php-5.5.32]# cd /application/php-5.5.32/etc/[root@web01 etc]# ls pear.conf php-fpm.conf.default[root@web01 etc]# cp php-fpm.conf.default php-fpm.conf[root@web01 etc]# lltotal 52-rw-r--r-- 1 root root 1332 Feb 27 22:53 pear.conf-rw-r--r-- 1 root root 22609 Feb 27 22:56 php-fpm.conf-rw-r--r-- 1 root root 22609 Feb 27 22:53 php-fpm.conf.default[root@web01 etc]# /application/php-5.5.32/sbin/php-fpm -t[27-Feb-2018 22:56:53] NOTICE: configuration file /application/php-5.5.32/etc/php-fpm.conf test is successful[root@web01 etc]# /application/php-5.5.32/sbin/php-fpm [root@web01 etc]# ss -lntup |grep 9000tcp LISTEN 0 16384 127.0.0.1:9000 *:* users:(("php-fpm",129733,7),("php-fpm",129734,0),("php-fpm",129735,0))
LNMP搭建网站前的测试
测试nginx与php配合是否成功php与MySQL配合是否成功测试nginx与php配合是否成功server { listen 80; server_name blog.etiantian.org; root html/blog; index index.php index.html index.htm; location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; }}echo ' ' >/application/nginx/html/blog/test_info.phpphp与MySQL配合是否成功test_mysql.php #部署博客 https://cn.wordpress.org/wordpress-4.9.4-zh_CN.tar.gzchown -R www.www *