centos編譯安裝php7

2021-09-23 15:35:46 字數 2422 閱讀 1655

1,安裝依賴包:

yum -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel 

libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel

readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel

ncurses curl gdbm-devel db4-devel libxpm-devel libx11-devel gd-devel gmp-devel expat-devel

xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip

tar -zxvf php-7.3.2.tar.gz

cd php-7.3.2

3,開始原始碼編譯:

./configure \

--prefix=/usr/local/php\

--enable-fpm\

--with-fpm-user=www\

--with-fpm-group=www\

--with-config-file-path=/usr/local/php/conf\

--disable-rpath\

--enable-soap\

--with-libxml-dir\

--with-xmlrpc\

--with-openssl\

--with-mhash\

--with-pcre-regex\

--with-zlib\

--enable-bcmath\

--with-bz2\

--enable-calendar\

--with-curl\

--enable-exif\

--with-pcre-dir\

--enable-ftp\

--with-gd\

--with-openssl-dir\

--with-jpeg-dir\

--with-png-dir\

--with-zlib-dir\

--with-freetype-dir\

--enable-gd-jis-conv\

--with-gettext\

--with-gmp\

--with-mhash\

--enable-mbstring\

--with-onig\

--with-mysqli=mysqlnd\

--with-pdo-mysql=mysqlnd\

--with-zlib-dir\

--with-readline\

--enable-shmop\

--enable-sockets\

--enable-sysvmsg\

--enable-sysvsem \

--enable-sysvshm \

--enable-wddx\

--with-libxml-dir\

--with-xsl\

--enable-zip\

--with-pear

之後(次步容易出現問題)

make -j 4 && make install

4,安裝後配置

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

環境變數

path=$path:/usr/local/php/bin

export path

5,完成安裝後配置php.ini檔案:

cp php.ini-development /usr/local/php/etc/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 sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service

啟動php-fpm

systemctl start php-fpm.service

檢視是否啟動成功:

ps aux | grep php-fpm

centos編譯安裝PHP7

在php.net中找到最新穩定版php原始碼 這裡我選擇了最新版php 7.1.9 wget php.tar gz net get php 7.1 9.tar gz from this mirror tar xzvf php.tar gzcd php 2 配置php 解壓了php原始碼之後,我們需要...

centos編譯安裝php7

yum y install openssl openssl devel curl curl devel libjpeg libjpeg devel libpng libpng devel freetype freetype devel pcre pcre devel libxslt libxslt ...

centos安裝php7編譯

centos7下安裝php7 php7 centos7 安裝php7 首先安裝一些必須的依賴,這裡就不闡述了,後面文章再細說 yum install y gcc c autoconf centos源不能安裝libmcrypt devel,由於版權的原因沒有自帶mcrypt的包 有兩種方法解決,一種是...