1. 程式人生 > 實用技巧 >PHP系列-編譯安裝

PHP系列-編譯安裝

php是後端動態語言,主要是用php來處理邏輯和操作資料庫等等

php是指令碼語言,無需編譯即可執行

php在web開發中應用廣泛

php的下載地址

http://php.net/downloads.php

PHP編譯安裝

1.安裝依賴包

yum -y install epel-release
yum -y install gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel openldap openldap-devel libmcrypt libmcrypt-devel sqlite-devel
oniguruma oniguruma-devel

2.安裝

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-ctype --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fpm
make && make instal

複製一個配置檔案

cp php.ini-production /usr/local/php/etc/php.ini

安裝驗證

[root@Nginx php-7.4.6]# /usr/local/php/bin/php -v   #檢視php版本
[root@Nginx php-7.4.6]# /usr/local/php/bin/php -m  #檢視php模組
[root@Nginx php-7.4.6]#/usr/local/php/bin/php -i|grep configure  #檢視php的環境檢查引數