安装apache
1、准备工作
1.2、下载Apache及组件
下载安装包和依赖包
1)httpd2.4.16
2)apr、apr-util
4)pcre8.36(或8.39)
5)openssl-1.0.1t
2、安装
2.1、安装apr和 apr-util
tar zxvf httpd-2.4.16-deps.tar.gzcd httpd-2.4.16/srclib/apr./configure --prefix=/usr/local/apache/aprmake && make installcd ../apr-util./configure --prefix=/usr/local/apache/apr-util --with-apr=/usr/local/apache/aprmake && make install
2.2、安装 zlib1.2.8
tar zxvf zlib-1.2.11.tar.gzcd zlib-1.2.11./configure --prefix=/usr/local/apache/zlibmake && make install
2.3、安装pcre
tar zxvf pcre-8.36.tar.gzcd pcre-8.36./configure --prefix=/usr/local/apache/pcremake && make install
2.4、安装openssl-1.0.1t
tar zxvf openssl-1.0.1t.tar.gz
cd openssl-1.0.1t
./config --prefix=/usr/local/apache/openssl -fPIC no-gost no-shared no-zlib --shared
make && make install
2.5、openssl升级(内网不需要升级)
mv /usr/bin/openssl /usr/bin/openssl.bakmv /usr/include/openssl /usr/include/openssl.bakln -s /usr/local/apache/openssl/bin/openssl /usr/bin/opensslln -s /usr/local/apache/openssl/include/openssl /usr/include/openssl
2.6、安装httpd2.4.16
tar zxvf httpd-2.4.16.tar.gzcd httpd-2.4.16./configure --prefix=/usr/local/apache/httpd --sysconfdir=/etc/httpd --enable-so --enable-cgi --enable-ssl --enable-rewrite --with-ssl=/usr/local/apache/openssl --with-pcre=/usr/local/apache/pcre --with-z=/usr/local/apache/zlib --with-apr=/usr/local/apache/apr --with-apr-util=/usr/local/apache/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=eventmake && make install
fullstatus 不可用
这时只要安装下lynx就行,centos可以通过如下yun install lynx安装
yum install lynx
问题:
You don't have permission to access /server-status on this server.
需要用httpd.conf配置中的用户启动
安装php
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum install php56w php56w-mysql php56w-gd libjpeg* php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mbstring php56w-bcmath php56w-fpm
由于无法编译安装的apache无法解析php
编译安装php
下载php
tar zvxf php-5.6.30.tar.gzcd php-5.6.30
yum安装依赖软件yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel sqlite-devel jemalloc jemalloc-devel libmcrypt
新建用户 php不建议使用root用户启动
groupadd wwwuseradd -g www -s /sbin/nologin www
编译相关参数
./configure --prefix=/usr/local/apache/php --with-apxs2=/usr/local/apache/httpd/bin/apxs --with-config-file-path=/usr/local/apache/php/etc --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline
make && make install
异常使用php mcrypt 前必须先安装Libmcryptlibmcrypt源码安装方法:wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/attic/libmcrypt/libmcrypt-2.5.7.tar.gztar -zxvf libmcrypt-2.5.7.tar.gzcd libmcrypt-2.5.7./configure --prefix=/usr/local/apache/libmcryptmake && make install
异常
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
因为centos是64位,所以在安装5.5.16过程中出现 define struct flock on this system, set --enable-opcache=no 错误
网上的其它的解决方式都不管用啊..
最后查看php官方文档解决. 在configure 里面加上 --with-libdir=lib64
异常 最后再解决
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.