linux 源碼安裝php7

事先準(zhǔn)備

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel MySQL pcre-devel?curl-devel?libxslt-devel?gcc-c++?zlib zlib-devel? libtool ?openssl openssl-devel

1、下載源碼

wget -O php-7.0.2.tar.gz?http://php.net/get/php-7.0.2.tar.gz/from/a/mirror

解壓

tar -zxvf?php-7.0.2.tar.gz

cd?php-7.0.2

2、安裝配置

./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

這是開啟php-fpm選項(xiàng)的。

3、編譯安裝

make

編譯出現(xiàn)

make: *** [sapi/cli/php] Error 1的解決辦法

make clean

之后再次

make

就可以了。

make install


4、檢測(cè)

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

看是否安裝成功

成功之后會(huì)返回

PHP 7.0.2 (cli) (built: Mar 11 2018 14:03:28) ( NTS )

Copyright (c) 1997-2015 The PHP Group

Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

5、配置文件

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

?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

6、啟動(dòng)php-fpm

/etc/init.d/php-fpm

7、停止php-fpm

killall php-fpm

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容