Chinaunix首页 | 论坛 | 博客
  • 博客访问: 229372
  • 博文数量: 35
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 938
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-12 14:52
文章分类

全部博文(35)

文章存档

2016年(4)

2015年(5)

2014年(16)

2013年(10)

我的朋友

分类: 系统运维

2013-09-26 16:27:51

下载地址 

tar zxf php-5.5.3.tar.gz
cd php-5.5.3
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl
/**/  这个参数可以根据自己的情况进行修改
--with-mysql : mysql的目录
--with-iconv-dir : iconv的目录 *这个不是必须的项 根据自己的情况选择 
make;make install

安装过程可能会出现错误。
----------------------------------------------------------------------------------
错误:configure: error: libjpeg.(a|so) not found.
    yum -y install libjpeg*
   
错误:configure: error:  libpng .(a|so) not found.
    yum -y install libpng*

错误:configure: error: freetype.h not found
    yum -y install freetype-devel

错误:configure: error: mcrypt.h not found. Please reinstall libmcrypt.
    yum -y install libmcrypt*

错误:error: XML configuration could not be found 
    yum -y install libxml2 libxml2-devel
    
错误:configure: error: Please reinstall libmhash - I cannot find mhash.h
    yum -y install mhash-devel

错误:configure: error: iconv not found, in order to build xmlrpc you need the iconv library
   重新安装iconv 并且在编译过程指定目录位置
 wget
    ./configure --prefix=/usr/local/iconv
     make ; make install
    
    并且在编译php的时候加上
    --with-iconv-dir=/usr/local/iconv

错误: configure: warning: lemon versions supported for regeneration of libsqlite parsers: 1.0 (found: none)
    wget
gcc -o lemon lemon.c
mv lemon /usr/local/bin

错误:error: Please reinstall the libcurl distribution easy.h should be in /include/curl/
    yum -y install curl-devel

错误:configure: error: Cannot find ldap.h
     yum -y install openldap-devel  openldap
----------------------------------------------------------------------------------

这样就完成了php的安装
修改$php/etc/php-fpm.conf文件
--------------------------------------------------------------------------------------
[global]
pid = /usr/local/webserver/php/php-fpm.pid                //php-fpm的pid文件
error_log = log/php-fpm.log                                        //php的log文件
 
rlimit_files = 65535                                                      
 
[www]
user = www                                                                  //php的启动用户
group = www                                                                //php的启动组
listen = 127.0.0.1:9000                                                //侦听端口
 
pm = dynamic                                                               //动态进程
pm.max_children = 5
pm.start_servers = 2                                                    //起始进程数
pm.min_spare_servers = 1                                           //最小进程数
pm.max_spare_servers = 3                                          //最大进程数
--------------------------------------------------------------------------------------

启动php
/usr/local/webserver/sbin/php-fpm
关闭php
kill $(cat '/usr/local/webserver/php/php-fpm.pid')

php的启动脚本
----------------------------------------------------------------------------------------------------
#!/bin/bash
# chkconfig: 2347 85 64
# description: this is a mysql contrl script
start() {
if [ -e /usr/local/webserver/php/php-fpm.pid ];then
    echo "启动php-fpm                                               [失败]"
else
    /usr/local/webserver/php/sbin/php-fpm
    echo "启动php-fpm                                               [确定]"
fi
}
stop(){
if [ -e /usr/local/webserver/php/php-fpm.pid ];then
    killall 'php-fpm'
    echo "停止php-fpm                                               [确定]"
else
    echo "停止php-fpm                                               [失败]"
fi
}
status(){
if [ -e /usr/local/webserver/php/php-fpm.pid ];then
    echo "php-fpm (pid $(cat /usr/local/webserver/php/php-fpm.pid))正在运行..."
else
    echo "php-fpm已停"
fi
}
case $1 in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
status)
status
;;
*)
echo "用法:/etc/init.d/php-fpm {start|stop|restart|reload|status}"
exit 3
esac
exit 0
----------------------------------------------------------------------------------------------------
阅读(3562) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~