apache安装与php整合配置

rpm -qa httpd

mkdir /home/dean/tools

cd /home/dean/tools  

ls -sh

tar xf httpd-2.2.31.tar.gz

mkdir -p /application/

mv httpd-2.2.31 /application/httpd-2.2.31

 cd /home/dean/tools/

cd httpd-2.2.31

yum install zlib zlib-devel -y

./configure --prefix=/application/apache2.2.31 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite

make&&make install

ln -s /application/apache2.2.31/ /application/apache

/application/apache/bin/apachectl    -t | start | graceful | stop

lsof -i :80

netstat -lntup|grep apache

 vim /application/apache/conf/httpd.conf

vim /application/apache/conf/extra/httpd.vhost.conf    (Options -Indexes FollowSymLinks   在inode前面加上-,注释掉,去掉包含httpd.vhost.conf以及httpd.mpm.conf的#)

egrep -v "#|^$" httpd.conf >httpd.conf.default

########################################

<Directory "/application/apache2.2.31/htdocs">
    Options -Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

#########################################

将上面的代码加入到extra/httpd.vhost.conf中并且修改其中的路径

 

wget http://cronolog.org/download/cronolog-1.6.2.tar.gz  下载日志轮询分析工具cronolog

tar xf cronolog-1.6.2.tar.gz

cd cronolog-1.6.2

./configure

make&&make install

vim httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin 958672189@qq.com
    DocumentRoot "/var/html/blog"
    ServerName blog.love.com
    ErrorLog "logs/blog-error_log"
    CustomLog "|/usr/local/sbin/cronolog /app/logs/access_bbs_%Y%m%d.log" combined     修改默认日志文件的配置
</VirtualHost>

 下载php程序:

wget http://cn2.php.net/get/php-5.3.27.tar.gz/from/cn2.php.net/mirrorfile mirror

tar xf mirror

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 更新yum源

tar xf libmcrypt-2.5.8.tar.gz

cd libmcrypt-2.5.8

cd libltdl/

./configure --enable-ltdl-install

make && make install

解决安装mcrypt报错的问题

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar xf  libiconv-1.14.tar.gz 

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv

make && make install

yum -y install libmcrypt-devel

yum -y install mhash

yum -y install mcrypt

yum install openssl-devel openssl -y

yum install pcre pcre-devel -y

 

cd php-5.3.27

touch ext/phar/phar.phar

./configure --prefix=/application/php5.5.26 \

--with-apxs2=/application/apache/bin/apxs \

--with-mysql=mysqlnd \       mysql的安装路,如果有安装设置好路径

--with-xmlrpc \

--with-openssl \

--with-freetype-dir \

--with-zlib \

--with-gd \

--with-jpeg-dir \

--with-png-dir \

--with-iconv=/usr/local/libiconv \

--enable-short-tags \

--enable-sockets \

--enable-zend-multibyte \

--enable-soap \

--enable-mbstring \

--enable-static \

--enable-gd-native-ttf \

--with-curl \

--with-xsl \

--enable-ftp \

--with-libxml-dir \

 注意与LNMP环境编译的区别,没有php-fpm,直接就可以运行php解析程序

make

make install

ln -s /application/php5.3.27 /application/php

cp php.ini-production /application/php/lib/php.ini

chattr -i /etc/passwd /etc/shadow /etc/group /etc/gshadow

wget -q http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip

unzip Discuz_X3.2_SC_UTF8.zip

 

useradd www -s /sbin/nologin -M

在apcache的httpd.conf中加入:

 AddType application/x-httpd-php .php .phtml
 AddType application/x-httpd-php-source .phps

2.并且改变User www

3.166gg  添加:index.php

 

chmod -R www.www /var/html/bbs/

对于编译的时候编译的参数出错导致安装后出现的一系列问题,如果是通过编译安装,make install安装的,可以直接重新编译安装即可

在使用./configure 之后应当 make clean  清空下缓存的上次编译结果

接着直接make

make install

 

cp php.ini-production /application/php/lib/php.ini

安装好之后,直接复制配置文件,不用手动启动即可解析php程序

 

 

几个卸载程序的命令:

rpm -e xxx.rpm

1、查找你要卸载的包:rpm -qa| grep 包名

2、rpm -e --nodeps 查找到的包   

或者使用yum remove 包

 

 

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

posted @ 2018-04-12 00:49  deanyang  阅读(1423)  评论(0编辑  收藏  举报