45321ttt 发表于 2016-12-2 08:47:58

centos7.1+apache2.4.x+php5.6

下载目录可能不同,请自行修改:

安装apache:
# yum install gcc gcc-c++ make wget
# yum install zlib-devel openssl-devel
# yum install -y perl perl-devel

1) apr
# wget http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
# tar zxvf apr-1.5.2.tar.gz
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apache/apr
# make && make install

2) apr-util
# wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
# tar zxvf apr-util-1.5.4.tar.gz
# cd apr-util-1.5.4
# ./configure --prefix=/usr/local/apache/apr-util --with-apr=/usr/local/apache/apr
# make && make install


3) pcre
# wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
# tar zxvf pcre-8.37.tar.gz
# cd pcre-8.37
# ./configure
# make && make install

4) apache
# cd /usr/local/src/
# wget http://apache.communilink.net//httpd/httpd-2.4.23.tar.gz
# tar zxvf httpd-2.4.23.tar.gz
# cd httpd-2.4.23
# ./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

# make && make install

配置httpd.conf确保以下字符串是否存在1.LoadModule php5_module modules/libphp5.so如果没有就加上(解析php)在AddType application*后面加如下一行2.AddType application/x-httpd-php .php .phtmlAddType 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


页: [1]
查看完整版本: centos7.1+apache2.4.x+php5.6