linux 源码安装php5.6

系统centos

下载

>wget http://hk1.php.net/get/php-5.6.15.tar.gz/from/this/mirror
>tar -xzf php-5.6.15.tar.gz

安装依赖
>yum -y install libxml2 libxml2-devel
>yum -y install curl curl-devel
>yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel
>yum -y install zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel

>yum -y install libmcrypt libmcrypt-devel mcrypt mhash

这一步如果遇到No package xxx available.a

更新下yum即可

>yum  install epel-release  //扩展包更新包
>yum  update 

>yum clean all

安装mysql 略(详见另一篇文章 linux源码安装mysql

编译安装开始

>./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config--with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-gd --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib-dir  --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
>make 
>make install
Installing shared extensions:     /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/php/bin/
Installing PHP CLI man page:      /usr/local/php/php/man/man1/
Installing PHP FPM binary:        /usr/local/php/sbin/
Installing PHP FPM config:        /usr/local/php/etc/
Installing PHP FPM man page:      /usr/local/php/php/man/man8/
Installing PHP FPM status page:   /usr/local/php/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php/bin/
Installing PHP CGI man page:      /usr/local/php/php/man/man1/
Installing build environment:     /usr/local/php/lib/php/build/
Installing header files:          /usr/local/php/include/php/
Installing helper programs:       /usr/local/php/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php/php/man/man1/
  page: phpize.1
  page: php-config.1
/root/php-5.6.15/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
ln -s -f phar.phar /usr/local/php/bin/phar
Installing PDO headers:          /usr/local/php/include/php/ext/pdo/


复制配置文件
>cp php.ini-production /usr/local/php/etc/php.ini
>cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
>cp sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf
修改启动用户(新建用户,组)
>vi /usr/local/php/etc/php-fpm.conf
约149行
user = 用户名
group = 组名


配置开机启动
>chmod 755 /etc/init.d/php-fpm
>chkconfig --add php-fpm
>chkconfig --level 345 php-fpm on


启动
>/etc/init.d/php-fpm start
Starting php-fpm  done
>/etc/init.d/php-fpm --help查看更多
Usage: ./php-fpm {start|stop|force-quit|restart|reload|status}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值