1,下載解壓 tar xf php-7.2.0.tar.gz cd php-7.2.0/ 2,安裝必要的庫 sudo apt-get install libxml2-devsudo apt-get install openssl sudo apt-get install libssl-devsudo ...
1,下載解壓
tar xf php-7.2.0.tar.gz
cd php-7.2.0/
2,安裝必要的庫
sudo apt-get install libxml2-dev
sudo apt-get install openssl
sudo apt-get install libssl-dev
sudo apt-get install make
sudo apt-get install curl
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
sudo apt-get install libmcrypt-dev
3,編譯
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=ghostwu
make && sudo make install
4,寫一個測試文件,測試php
---------------------------------------------------------------------------------------------------------------------------------------------
以上為裸裝php
如果需要添加擴展可以重新編譯,或者用擴展安裝方式,記得重新編譯之前要make clean或者重新刪除解壓
較為基本的擴展安裝
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-iconv-dir=/usr/local/lib \
--enable-fpm --with-fpm-user=ghostwu \
--with-iconv-dir=/usr/local/lib \
--enable-mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-openssl \
--with-zlib