sh 使用Nginx和MySQL编译并将php 5.3.27安装到FastCGI模式

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 使用Nginx和MySQL编译并将php 5.3.27安装到FastCGI模式相关的知识,希望对你有一定的参考价值。

cd /home/oldboy/tools

# 1. Install dependencies
# Part 1: yum install
yum install -y		 	\
	freetype-devel	 	\
	gd-devel 		\
	libcurl-devel 		\
	libjpeg-turbo-devel 	\
	libpng-devel 		\
	libxml2-devel 		\
	libxslt-devel 		\
	zlib-devel

# Part 2: yum install from epel
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
yum install -y libmcrypt-devel mcrypt mhash

# Part 3: compile libiconv
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install

# 2. Download php source tarball and extract it
wget http://cn2.php.net/get/php-5.3.27.tar.gz/from/this/mirror
tar xvf php-5.3.27.tar.gz
cd php-5.3.27

# 3. Config
./configure 					\
	--prefix=/application/php-5.3.27 	\
	--disable-rpath 			\
	--enable-bcmath 			\
	--enable-fpm 				\
	--enable-ftp 				\
	--enable-gd-native-ttf 			\
	--enable-inline-optimization 		\
	--enable-mbregex 			\
	--enable-mbstring 			\
	--enable-pcntl 				\
	--enable-safe-mode 			\
	--enable-shmop 				\
	--enable-short-tags 			\
	--enable-soap 				\
	--enable-sockets 			\
	--enable-static 			\
	--enable-sysvsem 			\
	--enable-xml 				\
	--enable-zend-multibyte 		\
	--enable-zip 				\
	--with-curl 				\
	--with-curlwrappers 			\
	--with-fpm-group=nginx 			\
	--with-fpm-user=nginx 			\
	--with-freetype-dir 			\
	--with-gd 				\
	--with-iconv-dir=/usr/local/libiconv 	\
	--with-jpeg-dir 			\
	--with-libxml-dir=/usr 			\
	--with-mcrypt 				\
	--with-mhash 				\
	--with-mysql=/application/mysql 	\
	--with-openssl 				\
	--with-png-dir 				\
	--with-xmlrpc 				\
	--with-xsl 				\
	--with-zlib

# 4. Compile php
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
touch ext/phar/phar.phar
make
make install
ln -s /application/php-5.3.27 /application/php

# 5. Config php.ini
cp php.ini-production /application/php/lib/php.ini
vim /application/php/lib/php.ini
	safe_mode=On					# line 338
	expose_php=Off					# line 435
	display_errors=Off				# line 538
	log_errors=On					# line 559
	error_log=/application/logs/php_errors.log	# line 643
	register_globals=Off				# line 703
	magic_quotes_gpc=On				# line 756
	cgi.fix_pathinfo=0				# line 854
	allow_url_fopen=Off				# line 902

# 6. Config php-fpm.conf
cd /application/php/etc
cp php-fpm.conf.default php-fpm.conf

# 7. Start php into fastcgi mode
/application/php/sbin/php-fpm
# Check its status
ps aux | grep php-fpm
lsof -i :9000

以上是关于sh 使用Nginx和MySQL编译并将php 5.3.27安装到FastCGI模式的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 6.2编译安装Nginx1.2.0+MySQL5.5.25+PHP5.3.13

centos编译安装php5.6.20+nginx1.8.1+mysql5.6.17

安装LNMP服务----Nginx——>MySQL——>PHP——>论坛

debian系统安装最新lnmp编译最新php7.1.2及nginx1.10.3及mysql5.7及5.6

PHP编译遇到的问题

基于CentOS 6.8平台最新源代码包编译安装LNMP环境搭建(Nginx+MySQL+PHP)