php7.1.4 详细安装,ubuntu PHP7.1.4编译安装

1.下载

# wget http://php.net/get/php-7.1.4.tar.gz/from/a/mirror

或者# wget http://am1.php.net/distributions/php-7.1.4.tar.gz

前者得到一个mirror文件,后者得到php-7.1.4.tar.gz,均可以通过tar解压

2.解压

# tar zxvf php-7.1.4.tar.gz 或 tar zxvf mirror

# cd php-7.1.4

3.查看安装帮助,执行配置脚本来进行编译预处理

# ./configure --help

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

--with-curl \

--with-freetype-dir \

--with-gd \

--with-gettext \

--with-iconv-dir \

--with-kerberos \

--with-libdir=lib64 \

--with-libxml-dir \

--with-mysqli \

--with-openssl \

--with-pcre-regex \

--with-pdo-mysql \

--with-pdo-sqlite \

--with-pear \

--with-png-dir \

--with-xmlrpc \

--with-xsl \

--with-zlib \

--enable-fpm \

--enable-bcmath \

--enable-libxml \

--enable-inline-optimization \

--enable-gd-native-ttf \

--enable-mbregex \

--enable-mbstring \

--enable-opcache \

--enable-pcntl \

--enable-shmop \

--enable-soap \

--enable-sockets \

--enable-sysvsem \

--enable-xml \

--enable-zip

4.编译预处理可能会出现一些error,一般是缺少依赖包的原因,根据提示安装即可

# apt-get install libxml2 libxml2-dev

# apt-get install openssl

//configure: error: Please reinstall the libcurl distribution -

easy.h should be in /include/curl/

#apt-get install libssl-dev

#apt-get install libgtk2.0-dev

//configure: error: Please reinstall the libcurl distribution -

easy.h should be in /include/curl/

// RetHat CentOS or Fedora 使用下面安装命令

# yum install curl curl-devel

// Debian or Ubuntu使用下面的安装命令

# apt-get install curl

# apt-get install libcurl4-gnutls-dev

//configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

# apt-get install libxslt-dev

5.预处理通过之后就可以make编译了

# make && make install

6.配置php

编译安装成功后,一般可以在usr/local找到安装的php

//php.ini

# cp php.ini-development /usr/local/php/lib/php.ini

//php-fpm

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

# cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

# cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm 或cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

需要注意的是php7中www.conf这个配置文件配置phpfpm的端口号等信息,如果你修改默认的9000端口号需在这里改,再改nginx的配置

7.启动

//查看php版本

# /usr/local/php/bin/php -v

# /etc/init.d/php-fpm start

或 # service php-fpm start

//php-fpm 可用参数 start|stop|force-quit|restart|reload|status

//若权限不足需要需要加上执行权限

chmod +x /etc/init.d/php-fpm

//Starting php-fpm [06-May-2017 14:10:49] ERROR: [pool www] cannot get gid for group 'nobody'

[06-May-2017 14:10:49] ERROR: FPM initialization failed

failed

//确定php-fpm配置文件的路径,执行

#ps -aux | grep php-fpm

在安装目录的etc下有个php-fpm.d目录(如/usr/local/php/etc/php-fpm.d),打开这个目录后,找到www.conf文件,修改该文件里:

user = 启动fpm的用户名

group = 启动fpm的用户所在用户组

//不推荐用root用户启动,应当新建用户

#adduser phpq //新建phpq用户

#passwd phpq //给phpq用户设置密码

#groupadd test //新建test工作组

//The program 'php' can be found in the following packages:

* php7.0-cli

* hhvm

sudo apt install php

sudo apt install hhvm

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值