如何在centos6.8编译php7.1.10

目标:centos6.8上编译php7.1.10

问题拆解:

1.准备编译的centos6.8系统(百度云地址

2.编译的源代码php7.1.10(php7.1.10下载地址

3.安装编译的编译工具(安装编译工具的YUM仓库)

4.编译php7.1.10的各个模块

5.配置php并且启动验证


       这次我们的主要目标是教会大家编译安装php7.1.10,所以小编默认大家都有centos6.8的环境和从我们提供的地址下载好了相关软件,现在开启我们愉快的旅程吧!

安装下载好的repoforge的仓库

[root@localhost local]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Preparing...                ########################################### [100%]

package rpmforge-release-0.5.3-1.el6.rf.x86_64 is already installed

安装编译需要的开发包

[root@localhost local]# yum install -y "@Development tools"

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

epel/metalink             

......(省略无关信息)

Package flex-2.5.35-9.el6.x86_64 already installed and latest version

Package gcc-4.4.7-18.el6.x86_64 already installed and latest version

Package redhat-rpm-config-9.0.3-51.el6.centos.noarch already installed and latest version

Package rpm-build-4.8.0-55.el6.x86_64 already installed and latest version

Package 1:make-3.81-23.el6.x86_64 already installed and latest version

Package patch-2.6-6.el6.x86_64 already installed and latest version

Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version

Package gettext-0.17-18.el6.x86_64 already installed and latest version

Package automake-1.11.1-4.el6.noarch already installed and latest version

Package bison-2.4.1-5.el6.x86_64 already installed and latest version

Package libtool-2.2.6-15.5.el6.x86_64 already installed and latest version

Package autoconf-2.63-5.1.el6.noarch already installed and latest version

Package gcc-c++-4.4.7-18.el6.x86_64 already installed and latest version

Package binutils-2.20.51.0.2-5.47.el6_9.1.x86_64 already installed and latest version

Package patchutils-0.3.1-3.1.el6.x86_64 already installed and latest version

Package byacc-1.9.20070509-7.el6.x86_64 already installed and latest version

Package indent-2.2.10-7.el6.x86_64 already installed and latest version

Package systemtap-2.9-7.el6.x86_64 already installed and latest version

Package diffstat-1.51-2.el6.x86_64 already installed and latest version

Package elfutils-0.164-2.el6.x86_64 already installed and latest version

Package cvs-1.11.23-16.el6.x86_64 already installed and latest version

Package rcs-5.7-37.el6.x86_64 already installed and latest version

Package subversion-1.6.11-15.el6_7.x86_64 already installed and latest version

Package gcc-gfortran-4.4.7-18.el6.x86_64 already installed and latest version

Package 1:doxygen-1.6.1-6.el6.x86_64 already installed and latest version

Package intltool-0.41.0-1.1.el6.noarch already installed and latest version

Package git-1.7.1-9.el6_9.x86_64 already installed and latest version

Package ctags-5.8-2.el6.x86_64 already installed and latest version

Package cscope-15.6-7.el6.x86_64 already installed and latest version

Package swig-1.3.40-6.el6.x86_64 already installed and latest version

Warning: Group development does not have any packages.

Nothing to do

安装编译PHP模块各个开发包

[root@localhost local]# yum install -y libxml2-devel  libjpeg-devel libpng-devel freetype-devel openssl-devel  libcurl-devel libmcrypt-devel

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

* base: mirrors.sohu.com

* epel: mirrors.tuna.tsinghua.edu.cn

* extras: mirrors.sohu.com

* rpmforge: mirrors.tuna.tsinghua.edu.cn

* updates: mirrors.sohu.com

Package libxml2-devel-2.7.6-21.el6_8.1.x86_64 already installed and latest version

Package libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64 already installed and latest version

Package 2:libpng-devel-1.2.49-2.el6_7.x86_64 already installed and latest version

Package freetype-devel-2.3.11-17.el6.x86_64 already installed and latest version

Package openssl-devel-1.0.1e-57.el6.x86_64 already installed and latest version

Package libcurl-devel-7.19.7-53.el6_9.x86_64 already installed and latest version

Package libmcrypt-devel-2.5.8-9.el6.x86_64 already installed and latest version

Nothing to do

解压缩php-7.1.10.tar.gz

[root@localhost local]# tar xf php-7.1.10.tar.gz

[root@localhost local]# ls

bin  games  include  jdk1.7.0_75  jdk-7u75-linux-i586.tar_0.gz  lib  lib64  libexec  php7  php-7.1.10  php-7.1.10.tar.gz  pingan  rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm  sbin  share  src  var  zookeeper-3.4.6  zookeeper-3.4.6.tar.gz

开始编译php-7.1.10

[root@localhost php-7.1.10]# ./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql  --with-mysqli  --with-mcrypt=/usr/include --with-mhash --with-openssl --with-zlib --enable-zip  --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm  --with-fpm-user=apache --with-fpm-group=apache --without-gdbm --disable-fileinfo  --enable-maintainer-zts

checking for grep that handles long lines and -e... /bin/grep

checking for egrep... /bin/grep -E

checking for a sed that does not truncate output... /bin/sed

checking build system type... x86_64-unknown-linux-gnu

checking host system type... x86_64-unknown-linux-gnu

checking target system type... x86_64-unknown-linux-gnu

checking for cc... cc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether cc accepts -g... yes

checking for cc option to accept ISO C89... none needed

checking how to run the C preprocessor... cc -E

checking for icc... no

.........(省略中间过程)

creating libtool

appending configuration tag "CXX" to libtool

Generating files

configure: creating ./config.status

creating main/internal_functions.c

creating main/internal_functions_cli.c

+--------------------------------------------------------------------+

| License:                                                          |

| This software is subject to the PHP License, available in this    |

| distribution in the file LICENSE.  By continuing this installation |

| process, you are bound by the terms of this license agreement.    |

| If you do not agree with the terms of this license, you must abort |

| the installation process at this point.                            |

+--------------------------------------------------------------------+

Thank you for using PHP.

config.status: creating php7.spec

config.status: creating main/build-defs.h

config.status: creating scripts/phpize

config.status: creating scripts/man1/phpize.1

config.status: creating scripts/php-config

config.status: creating scripts/man1/php-config.1

config.status: creating sapi/cli/php.1

config.status: creating sapi/fpm/php-fpm.conf

config.status: creating sapi/fpm/www.conf

config.status: creating sapi/fpm/init.d.php-fpm

config.status: creating sapi/fpm/php-fpm.service

config.status: creating sapi/fpm/php-fpm.8

config.status: creating sapi/fpm/status.html

config.status: creating sapi/cgi/php-cgi.1

config.status: creating ext/phar/phar.1

config.status: creating ext/phar/phar.phar.1

config.status: creating main/php_config.h

config.status: executing default commands

(看到这样的结尾,恭喜你编译成功了)

最后编译安装

[root@localhost php-7.1.10]# make && make install

配置php-fpm

[root@localhost php-7.1.10]# cp -r php.ini-production  /usr/local/php7/etc/php.ini

[root@localhost php-7.1.10]# cp /usr/local/php7/etc/php-fpm.conf.default  /usr/local/php7/etc/php-fpm.conf

[root@localhost php-7.1.10]# cp /usr/local/php7/etc/php-fpm.d/www.conf.default  /usr/local/php7/etc/php-fpm.d/www.conf

Tips:

[root@localhost php-7.1.10]# useradd www 

把/usr/local/php7/etc/php-fpm.d/www.conf用户apache改成www

最后启动验证php-fpm

[root@localhost php-7.1.10]# /usr/local/php7/sbin/php-fpm

检验是否启动成功

[root@localhost php-7.1.10]# ps -ef|grep php

root      8518 28358  0 14:00 pts/1    00:00:00 grep php

root    27753    1  0 Oct16 ?        00:00:02 php-fpm: master process (/usr/local/php7/etc/php-fpm.conf)

www      27754 27753  0 Oct16 ?        00:00:01 php-fpm: pool www

www      27755 27753  0 Oct16 ?        00:00:01 php-fpm: pool www

www      28121 27753  0 Oct16 ?        00:00:01 php-fpm: pool www

出现这个说明安装大功告成,恭喜你了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,716评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,558评论 1 294
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,431评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,127评论 0 209
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,511评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,692评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,915评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,664评论 0 202
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,412评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,616评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,105评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,424评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,098评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,096评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,869评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,748评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,641评论 2 271

推荐阅读更多精彩内容