yum install make gcc gcc-c++ -y
下载地址:http://ijg.org
wget http://ijg.org/files/jpegsrc.v9a.tar.gz
mkdir -p /usr/local/webserver/libs/
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a/
./configure --prefix=/usr/local/webserver/libs --enable-shared --enable-static
make
make install
cd ..
下载地址:http://libpng.org/pub/png/libpng.html
wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.12.tar.gz
tar -zxvf libpng-1.6.12.tar.gz
cd libpng-1.6.12
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ..
下载地址:http://freetype.org/download.html
wget http://ncu.dl.sourceforge.net/project/freetype/freetype2/2.5.3/freetype-2.5.3.tar.bz2
tar -zxvf freetype-2.5.3.tar.bz2
cd freetype-2.5.3
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ..
下载地址:http://sourceforge.net/projects/mcrypt/
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/webserver/libs
make
make install
cd libltdl/
./configure --prefix=/usr/local/webserver/libs--enable-ltdl-install
make
make install
cd ../..
wget http://downloads.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.bz2
tar xvf mhash-0.9.9.9.tar.bz2
cd mhash-0.9.9.9/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ..
echo /usr/local/webserver/libs/lib >>/etc/ld.so.conf
ldconfig
下载地址:http://sourceforge.net/projects/mcrypt/
wgethttp://downloads.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
export LDFLAGS="-L/usr/local/webserver/libs/lib-L/usr/lib"
export CFLAGS="-I/usr/local/webserver/libs/include-I/usr/include"
touch malloc.h
./configure --prefix=/usr/local/webserver/libs--with-libmcrypt-prefix=/usr/local/webserver/libs
make
make install
cd ..
(使php支持curl重写、支持xml语言、支持gd图形处理库和支持openssl加密)
yum install libxml2-devel -y
yum install libcurl-devel -y
yum install -y gd gd-devel
yum install openssl openssl-devel -y
export LIBS="-lm -ltermcap -lresolv"
exportDYLD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
exportLD_LIBRARY_PATH="/usr/local/webserver/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64"
export LIBS=
export CFLAGS=
下载地址:http://php.net/downloads.php
wget http://cn2.php.net/get/php-5.5.16.tar.gz
tar -zxvf php-5.5.16.tar.gz
cd php-5.5.16
./configure --prefix=/usr/local/webserver/php--with-config-file-path=/usr/local/webserver/php/etc --with-iconv-dir--with-freetype-dir=/usr/local/webserver/libs--with-jpeg-dir=/usr/local/webserver/libs--with-png-dir=/usr/local/webserver/libs --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=/usr/local/webserver/libs --with-gd--enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets--with-xmlrpc --enable-zip --enable-soap --enable-opcache --with-pdo-mysql
--prefix=/usr/local/webserver/php
php安装位置
--with-config-file-path=/usr/local/webserver/php/etc
php配置文件位置
--with-iconv-dir
启用字符转换
--with-freetype-dir=/usr/local/webserver/libs
使支持freetype
--with-jpeg-dir=/usr/local/webserver/libs
使支持jpeg等图片格式
--with-png-dir=/usr/local/webserver/libs
使支持png等图片格式
--with-zlib
--enable-zip
支持zlib\zip压缩
--with-libxml-dir=/usr
--enable-xml
--with-xmlrpc
使支持xml语言
--disable-rpath
--enable-bcmath
使支持整型
--enable-shmop
允许PHP读,写,创建和删除UNIX共享内存段
--enable-sysvsem
--enable-inline-optimization
使用inline优化
--with-curl
使支持curl重写功能
--enable-mbregex
--enable-mbstring
支持mbregex、mbstring字符编码
--enable-fpm
支持PHPFastCGI管理器
--with-mcrypt=/usr/local/webserver/libs
--with-gd
--enable-gd-native-ttf
支持mcrypt、GD库
--with-openssl
支持openssl加密
--with-mhash
支持hash算法
--enable-pcntl
--enable-sockets
支持套接字
--enable-soap
支持简单对象访问协议
--enable-opcache
make
make install
cp php.ini-development /usr/local/webserver/php/etc/php.ini
ln -s/usr/local/webserver/mysql/lib/libmysqlclient.18.dylib/usr/lib/libmysqlclient.18.dylib
mv /usr/local/webserver/php/etc/php-fpm.conf.default/usr/local/webserver/php/etc/php-fpm.conf
tar -zxvf autoconf-latest.tar.gz -C ../tmp
cd ../tmp/autoconf-2.69/
./configure --prefix=/usr/local/webserver/libs
make
make install
cd ../../soft
tar -zxvf memcache-2.2.7.tgz -C ../tmp
cd ../tmp/memcache-2.2.7/
exportPHP_AUTOCONF="/usr/local/webserver/libs/bin/autoconf"
exportPHP_AUTOHEADER="/usr/local/webserver/libs/bin/autoheader"
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install
cd ../../soft
$ cp<php-5.3.3-source-dir>/sapi/fpm/init.d.php-fpm.in /etc/init.d/php-fpm
$ chmod 755 /etc/init.d/php-fpm
vim /etc/init.d/php-fpm
设置以下内容:
php_fpm_BIN=/usr/local/webserver/php/sbin/php-fpm
php_fpm_CONF=/usr/local/webserver/php/etc/php-fpm.conf
php_fpm_PID=/var/run/php-fpm.pid
cp /usr/local/webserver/libs/etc/php-fpm.conf.default /usr/local/webserver/libs/etc/php-fpm.conf
cp php.ini-production /usr/local/webserver/php/lib/php.ini
可以通过以下控制:
$ /etc/init.d/php-fpm start
$ /etc/init.d/php-fpm stop
$ /etc/init.d/php-fpm reload
开机启动
$ chkconfig php-fpm on
使用killall php-fpm也可以杀死所有进程
nginx.conf的server中加入如下配置,并重启:
location ~ \.php$ {
root /opt/www/bi;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
在指定的root目录下,写入一个
<?php
echo phpinfo();
?>
文件进行测试。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。