安装依赖软件
yum install gcc-c++
yum install make
yum install expat-devel
yum install perl
yum install curl-devel
yum install libxml2-devel
yum install libjpeg-devel
yum install libpng-devel
yum install freetype-devel
下载相关安装包
wget https://archive.apache.org/dist/httpd/httpd-2.4.54.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.7.0.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz
wget https://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz
wget https://www.php.net/distributions/php-7.4.33.tar.gz
安装Apache及其依赖环境apr,apr-util,pcre
tar -zxvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure --prefix=/usr/local/apr
make && make install
tar -zxvf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make instal
tar -zxvf pcre-8.35.tar.gz
cd pcre-8.35
./configure --prefix=/usr/local/pcre
make && make install
tar -zxvf httpd-2.4.54.tar.gz
cp -r apr-1.7.0 httpd-2.4.54/srclib/apr
cp -r apr-util-1.6.1 httpd-2.4.54/srclib/apr-util
cd httpd-2.4.54
./configure \
--prefix=/usr/local/apache2 \
--enable-so \
--enable-rewrite \
--enable-ssl \
--enable-modules=most \
--enable-mpms-shared=all \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre \
--with-mpm=event \
--with-included-apr
make && make install
安装PHP
wget https://www.php.net/distributions/php-7.4.33.tar.gz
tar -xvzf php-7.4.33.tar.gz
cd php-7.4.33
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
make && make install
配置PHP和Apache相关联
PHP安装成功后会在apache的modules目录下生成一个libphp.so动态库文件
vim /usr/local/apache2/conf/httpd.conf #加入一行
LoadModule php7_module modules/libphp7.so
在Apache的配置文件httpd.conf的
AddType application/x-httpd-php .php
配置index.php为默认执行的文件
DirectoryIndex index.html index.php
编写测试页面test.php
cd /usr/local/apache2/htdocs
vim test.php
phpinfo()
?>
访问测试页面,在浏览器输入服务器ip地址 http://192.168.174.132/test.php
安装和配置dokuwiki
wget -c http://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz
tar -xvzf dokuwiki-stable.tgz
cp -r dokuwiki-2022-07-31a /usr/local/apache2/htdocs/dokuwiki
浏览器访问 http://192.168.174.132/dokuwiki/install.php,配置dokuwiki
配置玩wiki后,就可以访问了http://192.168.174.132/dokuwiki
来源地址:https://blog.csdn.net/sealy_chang/article/details/127885425