LNMP之PHP安装操作步骤

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LNMP之PHP安装操作步骤相关的知识,希望对你有一定的参考价值。

=======> LNMP 之 php安装操作步骤 <==================
1、==>备份默认源==>下载mirrors.163.com源==>yum安装epel源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum install epel-release -y


====>查看依赖库
rpm -aq pcre pcre-devel openssl openssl-devel zlib-devel \
libxml2-devel libjpeg-turbo-devel libpng-devel libcurl-devel libxslt-devel \
freetype-devel gd-devel mhash mhash-devel mcrypt libmcrypt-devel

yum install pcre pcre-devel openssl openssl-devel zlib-devel \
libxml2-devel libjpeg-turbo-devel libpng-devel libcurl-devel libxslt-devel \
freetype-devel gd-devel mhash mhash-devel mcrypt libmcrypt-devel -y
 
=======>mhash、mhash-devel加密扩展库、mcrypt加密扩展库
    mhash mhash-devel mcrypt libmcrypt-devel

2、====>安装 libiconv-devel库,需要第三方;
mkdir /home/tools/ -p
cd /home/tools/
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz  
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
cd ../

============LNMP==============================================
3、====>配合nginx安装PHP-5.3.27参数   ===> --with-mysql=mysqlnd \
cd /home/tools
rz php-5.3.27.tar.gz
tar zxf php-5.3.27.tar.gz
cd php-5.3.27/
./configure \
--prefix=/application/php-5.3.27 \
--with-mysql=/application/mysql \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--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-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-ftp

=================================================================
==========先执行以下一种再make否则会报错=========================
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar

=========================
echo "/application/mysql/lib" >>/etc/ld.so.conf
ldconfig

=================================================================
make && make install

ln -s /application/php-5.3.27/ /application/php
cp php-5.3.27/php.ini-production /application/php/lib/php.ini

=====>配置文件
[[email protected] tools]# ll php-5.3.27/php.ini*
-rw-r--r-- 1 101 101 69606 Jul 11  2013 php-5.3.27/php.ini-development  ==>开发环境
-rw-r--r-- 1 101 101 69627 Jul 11  2013 php-5.3.27/php.ini-production   ==>生产环境
=====>上传或修改配置文件
rz php-fpm.conf.5.3.27-cxybase
mv php-fpm.conf.5.3.27-cxybase /application/php/etc/php-fpm.conf
mkdir -p /app/logs

/application/php/sbin/php-fpm -t          ====>检查语法
/application/php/sbin/php-fpm             ====>启动PHP
netstat -lntup|grep php-fpm                 ====>查看服务进程
ps -ef|grep php-fpm|grep -v grep

=================================================================
开机自启动:
/application/php/sbin/php-fpm
/application/nginx/sbin/nginx

以上是关于LNMP之PHP安装操作步骤的主要内容,如果未能解决你的问题,请参考以下文章

LNMP编译安装之nginx关联php--图文详解

企业网站应用模式之—LNMP架构的源码编译超详细步骤,有手就行!

lnmp环境搭建之编译安装php-5.3.27.tar.gz

Ubuntu14.04安装lnmp(nginx+php-fpm+mysql), nginx reload总是fail,附操作步骤,请指点,谢谢。

编译安装LNMP架构之Discuz论坛

基于CentOS6.5环境之下的LNMP之编译安装PHP5.5.30