下载目录可能不同,请自行修改:
安装apache:
[iyunv@localhost ~]# yum install gcc gcc-c++ make wget
[iyunv@localhost ~]# yum install zlib-devel openssl-devel
[iyunv@localhost ~]# yum install -y perl perl-devel
1) apr
[iyunv@localhost src]# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
[iyunv@localhost src]# tar zxvf apr-1.5.2.tar.gz
[iyunv@localhost src]# cd apr-1.5.2
[iyunv@localhost apr-1.5.2]# ./configure --prefix=/usr/local/apache/apr
[iyunv@localhost apr-1.5.2]# make && make install
2) apr-util
[iyunv@localhost src]# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
[iyunv@localhost src]# tar zxvf apr-util-1.5.4.tar.gz
[iyunv@localhost src]# cd apr-util-1.5.4
[iyunv@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/apache/apr-util --with-apr=/usr/local/apache/apr
[iyunv@localhost apr-util-1.5.4]# make && make install
3) pcre
[iyunv@localhost src]# wget ftp://ftp.csx.cam.ac.uk/pub/soft ... re/pcre-8.37.tar.gz
[iyunv@localhost src]# tar zxvf pcre-8.37.tar.gz
[iyunv@localhost src]# cd pcre-8.37
[iyunv@localhost pcre-8.37]# ./configure
[iyunv@localhost pcre-8.37]# make && make install
4) apache
[iyunv@localhost ~]# cd /usr/local/src/
[iyunv@localhost ~]# wget http://apache.communilink.net//httpd/httpd-2.4.23.tar.gz
[iyunv@localhost src]# tar zxvf httpd-2.4.23.tar.gz
[iyunv@localhost src]# cd httpd-2.4.23
[iyunv@localhost httpd-2.4.17]# ./configure --prefix=/usr/local/apache \
--with-apr=/usr/local/apache/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apache/apr-util/bin/apu-1-config \
--enable-module=so \
--enable-mods-shared=all \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-cache \
--enable-file-cache \
--enable-mem-cache \
--enable-disk-cache \
--enable-mime-magic \
--enable-authn-dbm \
--enable-vhost-alias \
--enable-so \
--enable-rewrite \
--enable-ssl \
--with-mpm=prefork
[iyunv@localhost httpd-2.4.17]# make && make install
配置httpd.conf 确保以下字符串是否存在 1.LoadModule php5_module modules/libphp5.so 如果没有就加上(解析php) 在AddType application*后面加如下一行 2.AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps
3.添加默认index.php <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> 4.打开虚拟机配置
Include conf/extra/httpd-vhosts.conf
//配置虚拟机主机
# vi /usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/usr/local/nginx/html/web"
ServerName woliu.info
#ServerAlias www.dummy-host.example.com
ErrorLog "logs/woliu_error__log"
CustomLog "logs/woliu_access_log" common
<Directory /usr/local/nginx/html/web>
Require all granted #apache2.4以上的配置
</Directory>
</VirtualHost>
安装PHP:
1.下载php源码
2.PHP编译安装
./configure --prefix=/usr/local/fastphp \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-gd \
--with-zlib \
--with-libxml-dir \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-gd-native-ttf \
--disable-phar \
--without-pear
将pear 屏蔽掉编译安装后,再进行安装:同时因为phar属于pear的一个库,所以不将phar关闭掉
会看到/usr/local/apache/modules下生成 libphp5.so php模块
启动:
/usr/local/apache/bin/apachectl
|