继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

编译安装PHP

安卓入门学习视频
关注TA
已关注
手记 267
粉丝 68
获赞 387

安装PHP

   安装前置

    yum install libpng libjpeg freetype libmcrypt libmcrypt-devel libpng-devel libjpeg-devel freetype-devel libxml2 libxml2-devel libcurl libcurl-devel

   下载解压

   wget http://cn2.php.net/distributions/php-5.6.16.tar.gz

tar -zxvf php-5.6.16.tar.gz

   编译安装 


./configure --prefix=/usr/local/php \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-iconv-dir \

--with-freetype-dir \

--with-jpeg-dir \

--with-png-dir \

--with-zlib \

--with-libxml-dir \

--enable-xml \

--disable-rpath \

--enable-bcmath \

--enable-shmop \

--enable-sysvsem \

--enable-inline-optimization \

--with-curl \

--with-mcrypt \

--with-curlwrappers \

--enable-mbregex \

--enable-fpm \

--enable-mbstring \

--with-gd \

--enable-gd-native-ttf \

--with-openssl \

--with-mhash \

--enable-pcntl \

--enable-sockets \

--with-xmlrpc \

--enable-zip \

--enable-soap \

--without-pear \

--enable-mbstring \

--enable-pdo \

--with-config-file-path=/etc


   安装make && make install 

配置php

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

sed -i '/listen = 127.0.0.1:9000/a\listen = /dev/shm/php-fpm.sock' /usr/local/php/etc/php-fpm.conf

sed -i 's/nobody/nginx/g' /usr/local/php/etc/php-fpm.conf

sed -i 's/listen = 127.0.0.1/#&/' /usr/local/php/etc/php-fpm.conf

sed -i  '/listen.mode = 0660/a\listen.mode = 0666' /usr/local/php/etc/php-fpm.conf

echo "./usr/local/php/sbin/php_fpm" >> /etc/rc.local

添加php-fpm开机启动脚本 

#!/bin/bash# php-fpm startup script for the php-fpm # php-fpm version:5.5.0-alpha6# chkconfig: - 85 15# description: php-fpm is very good# processname: php-fpm# pidfile: /var/run/php-fpm.pid# config: /usr/local/php/etc/php-fpm.conf    php_command=/usr/local/php/sbin/php-fomphp_config=/usr/local/php/etc/php-fpm.confphp_pid=/usr/local/php/var/run/php-fpm.pidRETVAL=0prog="php-fpm"    #start functionphp_fpm_start() {    /usr/local/php/sbin/php-fpm}    start(){    if [ -e $php_pid  ]    then    echo "php-fpm already start..."    exit 1    fi    php_fpm_start}    stop(){    if [ -e $php_pid ]    then    parent_pid=`cat $php_pid`    all_pid=`ps -ef | grep php-fpm | awk '{if('$parent_pid' == $3){print $2}}'`    for pid in $all_pid    do            kill $pid        done        kill $parent_pid    fi    exit 1}    restart(){    stop    start}    # See how we were called.case "$1" instart)        start        ;;stop)        stop        ;;restart)        stop        start        ;;status)        status $prog        RETVAL=$?        ;;*)        echo $"Usage: $prog {start|stop|restart|status}"        exit 1esacexit $RETVAL

添加

  chkconfig --add php-fpm

  chkocnifg php-fpm on


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP