Linux環境下配置Apache+PHP
1、安裝apache
1.1、安裝apr
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.6.3.tar.gz
tar -zxvf apr-1.6.3.tar.gz
cd apr-1.6.3
./configure
make
make install
1.2、安裝apr-util
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure
make
make install
1.3、安裝pcre
wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
tar -zxvf pcre-8.42.tar.gz
cd pcre-8.42
./configure
make
make install
1.4、安裝apache
wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.34.tar.gz
tar -zxvf httpd-2.4.34.tar.gz
cd httpd-2.4.34
./configure
make
make install
啟動服務
/usr/local/apache2/bin/apachectl start
停止服務
/usr/local/apache2/bin/apachectl stop
重啟服務
/usr/local/apache2/bin/apachectl restart
重啟服務的時候不中斷當前連線
/usr/local/sbin/apachectl graceful
1.4、問題
1、提示no acceptable C compiler found in $PATH
apt-get install build-essential
2、提示Fatal error: expat.h: No such file or directory
apt install libexpat1-dev
3、提示recipe for target 'htpasswd' failed、recipe for target 'all-recursive' failed
把下載下來的apr和apr-util解壓到httpd-2.4.34目錄的srclib下
例如cp -r apr-1.6.3 /usr/local/server/apache/httpd-2.4.34/srclib/apr
cp -r apr-util-1.6.1 /usr/local/server/apache/httpd-2.4.34/srclib/apr-util
安裝apache的時候,./configure換成
./configure –with-prce=‘/usr/local/bin/pcre-config’ –with-included-apr
2、安裝PHP
wget http://cn2.php.net/get/php-7.2.8.tar.gz/from/this/mirror
mv mirror php-7.2.8.tar.gz
tar -zxvf php-7.2.8.tar.gz
cd php-7.2.8
./configure --with-apxs2=/usr/local/apache2/bin/apxs
make
make test
make install
問題
1、提示libxml2 not found
apt-get install libxml2-dev