如何在centos6.8編譯php7.1.10

目標(biāo):centos6.8上編譯php7.1.10

問題拆解:

1.準(zhǔn)備編譯的centos6.8系統(tǒng)(百度云地址

2.編譯的源代碼php7.1.10(php7.1.10下載地址

3.安裝編譯的編譯工具(安裝編譯工具的YUM倉庫)

4.編譯php7.1.10的各個(gè)模塊

5.配置php并且啟動(dòng)驗(yàn)證


? ? ? ?這次我們的主要目標(biāo)是教會(huì)大家編譯安裝php7.1.10钟些,所以小編默認(rèn)大家都有centos6.8的環(huán)境和從我們提供的地址下載好了相關(guān)軟件绊谭,現(xiàn)在開啟我們愉快的旅程吧!

安裝下載好的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

安裝編譯需要的開發(fā)包

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

Loaded plugins: fastestmirror

Setting up Install Process

Loading mirror speeds from cached hostfile

epel/metalink? ? ? ? ? ? ?

......(省略無關(guān)信息)

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模塊各個(gè)開發(fā)包

[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

(看到這樣的結(jié)尾,恭喜你編譯成功了)

最后編譯安裝

[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

最后啟動(dòng)驗(yàn)證php-fpm

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

檢驗(yàn)是否啟動(dòng)成功

[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

出現(xiàn)這個(gè)說明安裝大功告成,恭喜你了

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末欲主,一起剝皮案震驚了整個(gè)濱河市扁瓢,隨后出現(xiàn)的幾起案子邑狸,更是在濱河造成了極大的恐慌涤妒,老刑警劉巖赚哗,帶你破解...
    沈念sama閱讀 218,941評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件屿储,死亡現(xiàn)場離奇詭異,居然都是意外死亡够掠,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,397評論 3 395
  • 文/潘曉璐 我一進(jìn)店門赊堪,熙熙樓的掌柜王于貴愁眉苦臉地迎上來竖哩,“玉大人,你說我怎么就攤上這事遵绰。” “怎么了椿访?”我有些...
    開封第一講書人閱讀 165,345評論 0 356
  • 文/不壞的土叔 我叫張陵成玫,是天一觀的道長。 經(jīng)常有香客問我梁剔,道長,這世上最難降的妖魔是什么码撰? 我笑而不...
    開封第一講書人閱讀 58,851評論 1 295
  • 正文 為了忘掉前任个盆,我火速辦了婚禮,結(jié)果婚禮上颊亮,老公的妹妹穿的比我還像新娘。我一直安慰自己绍在,他們只是感情好雹有,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,868評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著溜宽,像睡著了一般质帅。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上煤惩,一...
    開封第一講書人閱讀 51,688評論 1 305
  • 那天盟庞,我揣著相機(jī)與錄音,去河邊找鬼什猖。 笑死红淡,一個(gè)胖子當(dāng)著我的面吹牛降铸,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播桶蝎,決...
    沈念sama閱讀 40,414評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼谅畅,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了胜茧?” 一聲冷哼從身側(cè)響起仇味,我...
    開封第一講書人閱讀 39,319評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎丹墨,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體喉前,經(jīng)...
    沈念sama閱讀 45,775評論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡王财,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,945評論 3 336
  • 正文 我和宋清朗相戀三年搪搏,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了闪金。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,096評論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡哎垦,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出墨闲,到底是詐尸還是另有隱情郑口,我是刑警寧澤盾鳞,帶...
    沈念sama閱讀 35,789評論 5 346
  • 正文 年R本政府宣布瞻离,位于F島的核電站,受9級特大地震影響套利,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜验辞,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,437評論 3 331
  • 文/蒙蒙 一喊衫、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧鼻听,春花似錦、人聲如沸撑碴。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,993評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽亿卤。三九已至鹿霸,卻和暖如春排吴,著一層夾襖步出監(jiān)牢的瞬間懦鼠,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,107評論 1 271
  • 我被黑心中介騙來泰國打工街氢, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留睦袖,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,308評論 3 372
  • 正文 我出身青樓伦乔,卻偏偏與公主長得像,于是被迫代替她去往敵國和親评矩。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,037評論 2 355

推薦閱讀更多精彩內(nèi)容