一键安装lnmp之php

#!/bin/sh

创新互联专注于集贤企业网站建设,成都响应式网站建设公司,商城系统网站开发。集贤网站建设公司,为集贤等地区提供建站服务。全流程按需规划网站,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

#一键安装LNMP中的php

#required soft

#libiconv-1.14.tar.gz

#libmcrypt-2.5.8.tar.gz

#mcrypt-2.6.8.tar.gz

#mhash-0.9.9.9.tar.gz

#php-5.3.27.tar.gz

#php-fpm.conf

#安装相关依赖库

yum install zlib libxml libjpeg freetype libpng gd  curl libiconv  zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt* -y

#安装libiconv依赖库,用于字符集转换的库

[ -e /home/lvnian/tools ] || mkdir -p /home/lvnian/tools

cd /home/lvnian/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 ..

[ $? -ne 0 ] && {

echo "libiconv is fail !!"

exit 1

}

#安装加密库(不是必须的)

tar zxf libmcrypt-2.5.8.tar.gz 

cd libmcrypt-2.5.8

./configure 

make && make install

/sbin/ldconfig 

cd libltdl/

./configure --enable-ltdl-install

make && make install

[ $? -ne 0 ] && {

echo "libmcrypt is fail !!"

exit 1

}

###

cd /home/lvnian/tools

tar zxf mhash-0.9.9.9.tar.gz 

cd mhash-0.9.9.9

./configure 

make && make install

[ $? -ne 0 ] && {

echo "mhash is fail !!"

exit 1

}

#安装mcrypt

cd /home/lvnian/tools

tar zxf mcrypt-2.6.8.tar.gz 

cd  mcrypt-2.6.8

sleep 2

/sbin/ldconfig 

./configure LD_LIBRARY_PATH=/usr/local/lib

make

make install

[ $? -ne 0 ] && {

echo "mcrypt is fail !!"

exit 1

}

##安装php

cd /home/lvnian/tools

tar zxf php-5.3.27.tar.gz 

cd php-5.3.27

./configure \

--prefix=/application/php5.3.27 \

--with-MySQL=/application/mysql \

--with-iconv=/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 

ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64

cp /home/lvnian/tools/php-5.3.27/ext/phar/phar.php /home/lvnian/tools/php-5.3.27/ext/phar/phar.phar

y

cp /home/lvnian/tools/php-5.3.27/ext/phar/phar/phar.php /home/lvnian/tools/php-5.3.27/ext/phar/phar.php

y

make 

cp /home/lvnian/tools/php-5.3.27/ext/phar/phar.php /home/lvnian/tools/php-5.3.27/ext/phar/phar.phar

y

make install

[ $? -ne 0 ] && {

echo "php is fail !!"

exit 1

}

#制作php的软连接

 ln -s /application/php5.3.27/ /application/php

 ll /application

 

#配置php

cp  /home/lvnian/tools/php-5.3.27/php.ini-production /application/php/lib/php.ini

cp /home/lvnian/tools/php-fpm.conf /application/php/etc/ 

 mkdir /app/logs/ -p

 /application/php/sbin/php-fpm -t

 #启动php

 /application/php/sbin/php-fpm

 sleep 5

 echo '----------------------php--------------------------'

 netstat -lntup | grep php |grep -v grep

lsof -i :9000


分享标题:一键安装lnmp之php
分享链接:http://myzitong.com/article/pcpohg.html