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' failedrecipe for target 'all-recursive' failed

把下载下来的aprapr-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

猜你喜欢

转载自blog.csdn.net/xavierzgx/article/details/84583899