Centos7 編譯安裝PHP

2021-10-04 11:46:44 字數 3660 閱讀 6254

準備環境

mkdir -p /data/conf/php7

mkdir -p /data/logs/php7

mkdir -p /root/software

yum groupinstall 'development tools'
2、安裝依賴包

1cd /root/software/php74、編譯安裝

.

/configure --prefix=

/usr/local/php7 --sysconfdir=

/data/conf/php7 --with-config-file-path=

/data/conf/php7 --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-******xml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache

make && make install

5、檢視版本

/usr/local/php7/bin/php -v
6、新增環境變數

vim /etc/profile

在最後新增

####php####

path=$path:

/usr/local/php7/bin

export path

source /etc/profile

8、配置php-fpm

cp php.ini-production /data/conf/php7/php.ini

cp /data/conf/php7/php-fpm.conf.default /data/conf/php7/php-fpm.conf

cp /data/conf/php7/php-fpm.d/www.conf.default /data/conf/php7/php-fpm.d/www.conf

9、設定啟動關閉

cp /root/software/php7/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

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

service php-fpm start  #啟動

service php-fpm stop   #停止

service php-fpm restart #重啟

10、檢查程式埠是否啟動

netstat -utpln

proto recv-q send-q local address foreign address state pid/program name

tcp 0

0127.0

.0.1

:9000

0.0.0.0:

* listen 4220

/php-fpm: maste

11、動態安裝php模組

#進入安裝包目錄

#解壓安裝包

tar xf imagick-

3.4.3

.tgz

#進入安裝包目錄

cd imagick-

3.4.3

#執行phpize命令

/usr/local/php7/bin/phpize

#編譯安裝

./configure --with-php-config=

/usr/local/php7/bin/php-config

make

make install

CentOS 7 編譯安裝 PHP 7

使用編譯的方式來安裝 php 7。輸入yum y install libxml2 libxml2 devel openssl openssl devel curl devel libjpeg devel libpng devel freetype devel libmcrypt devel mhas...

CentOS 7 編譯安裝 PHP 7

使用編譯的方式來安裝 php 7。輸入yum y install libxml2 libxml2 devel openssl openssl devel curl devel libjpeg devel libpng devel freetype devel libmcrypt devel mhas...

Centos7 編譯安裝PHP7

centos7 編譯安裝php7 yum groupinstall development tools 2 安裝依賴包 yum install libxml2 libxml2 devel openssl openssl devel bzip2 bzip2 devel libcurl libcurl ...