标签:
[安装依赖]
yum -y install epel-release
yum groupinstall "development tools"
yum -y install mhash mhash-devel mcrypt
yum -y install zlib zlib-devel libjpeg libjpeg-devel freetype freetype-devel gd gd-devel curl curl-devel libxml2 libxml2-devel libxslt libxslt-devel libmcrypt libmcrypt-devel libc-client-devel postgresql-devel
ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
[安装libiconv]
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make &&make install
(这个这个软件本身存在的一个Bug,通过Google,发现一个解决该问题的补丁,内容如下:
1.--- srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300
2.+++ srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200
3.@@ -695,7 +695,9 @@
4.
7.-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
8.+#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
9.+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
10.+#endif
11. #endifPS:内容中的"+"表示新增的内容,"-"表示删除的内容!
那我们只要进行如下操作即可解决这个问题:1. 切换到srclib目录下:
1.$cd srclib
2. 修改stdio.in.h文件:
1.$vi stdio.in.h
通过搜索,定位到_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");这一行,然后在这一行的前后加上条件编译即可,修改后的内容如下:
#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16)
GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
#endif
3\保存退出,然后再进行make, make install便可顺利安装^-^
)
[编译php]
wget http://php.net/distributions/php-5.6.11.tar.gz
tar xvf php-5.6.11.tar.gz
cd php-5.6.11
./configure --prefix=/usr/local/php \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-mysqlnd \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--with-curl \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--with-gettext \
--with-kerberos \
--with-imap=/usr/local/php-imap \
--with-imap-ssl \
--with-pcre-regex \
--enable-exif \
--enable-mbregex \
--enable-sysvshm \
--enable-inline-optimization \
--disable-rpath \
--with-pgsql \
--enable-calendar \
--with-zlib-dir \
--enable-xmlreader \
--enable-xmlwriter \
--enable-static \
--with-xsl \
--enable-ftp \
--enable-opcache \
--disable-fileinfo
make&&make install
(如ext/standard/.libs/basic_functions.o: In function `zm_startup_basic‘:/usr/local/soft/php-5.6.11/ext/standard/basic_functions.c:3664: undefined reference to `zm_startup_dns‘错误,可能是编译过,make clean 后再编译即可)
(./configure --prefix=/usr/local/php --with-pdo-pgsql --with-zlib-dir --with-freetype-dir --with-pcre-dir --enable-mbstring --with-libxml-dir=/usr --enable-soap --enable-calendar --with-curl --with-mcrypt=/usr/local/libmcrypt --with-zlib --with-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --with-zlib --enable-sockets --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --with-zlib --enable-zip --with-pcre-regex --with-mysql --with-pdo-mysql --with-mysqli --with-jpeg-dir=/usr --with-png-dir=/usr --enable-gd-native-ttf --with-openssl --enable-ftp --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --enable-opcache=no --enable-fpm --with-fpm-user=www --with-fpm-group=www --disable-fileinfo --with-imap=/usr/local/php-imap)
[添加环境变量]
export PATH=/usr/local/php/bin:$PATH
vim /etc/profile
最后一行添加
export PATH="/usr/local/php/bin:$PATH"
source /etc/profile
[复制配置文件]
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[将 php-fpm 配置为服务]
#!/bin/bash
#
# Startup script for the PHP-FPM server.
#
# chkconfig: 345 85 15
# description: PHP is an HTML-embedded scripting language
# processname: php-fpm
# config: /usr/local/php/etc/php.ini
# Source function library.
. /etc/rc.d/init.d/functions
PHP_PATH=/usr/local
DESC="php-fpm daemon"
NAME=php-fpm
DAEMON=$PHP_PATH/php/sbin/$NAME
CONFIGFILE=$PHP_PATH/php/etc/php-fpm.conf
INI_CONFIGFILE=$PHP_PATH/php/etc/php.ini
PIDFILE=$PHP_PATH/php/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
rh_start() {
$DAEMON -y $CONFIGFILE -c $INI_CONFIGFILE || echo -n " already running"
}
rh_stop() {
kill -QUIT `cat $PIDFILE` || echo -n " not running"
}
rh_reload() {
kill -HUP `cat $PIDFILE` || echo -n " can‘t reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
rh_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
rh_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
rh_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
rh_stop
sleep 1
rh_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0
chmod +x /etc/init.d/php-fpm
service php-fpm restart
chkconfig --level 35 php-fpm on
nginx.conf补上
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/blog$fastcgi_script_name;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
access_log off;
./configure --with-php-config=/usr/local/php5/bin/php-config --with-imap=/usr/lib64 --with-imap-ssl --with-kerberos make;make install vi /etc/php.d/imap.ini extension = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/imap.so service php-fpm restart
标签:
原文地址:http://www.cnblogs.com/phpgod/p/5568752.html