一开始就学LNMP,今天想装个apache,顺便把php升级了最新版,
安装apache大致按照网上方法编译了,没有出先问题。
PHP编译时要加 --with-apxs2=/app/apache/bin/apxs
./configure --prefix=/app/php5 --with-config-file-path=/app/php5/etc --with-mysql=/app/mysql5 --with-mysqli=/app/mysql5/bin/mysql_config --with-iconv-dir=/usr/local --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pdo_mysql --with-apxs2=/app/apache/bin/apxs
apache安装方法从网上找来的:
./configure --prefix=/app/apache --enable-so make && make install cp httpd.conf httpd.conf.bak vim http.conf //修改端口80为其它,因为80端口我已经给nginx了 chkconfig --list httpd //查看httpd服务是否已存在 chkconfig httpd off //关闭系统自带了httpd的服务,如果存在httpd服务 service httpd status //查看自带httpd服务状态 /app/apache/bin/apachectl -k start //linux启动apache命令 cp /app/apache/bin/apachectl /etc/rc.d/init.d/apache //拷贝apache启动脚本 vi /etc/rc.d/init.d/apache // 这里是编辑apache启动脚本 在开头的#!/bin/sh 下面加上 #chkconfig: 2345 85 15 chkconfig --add apache //添加apache服务 chkconfig --list apache //列出apache服务 service apache stop //停止apache服务 service apache start //启动apache服务
安装完成,配置httpd.conf 以支持php
vim /app/apache/conf/httpd.conf
在LoadModule php5_module modules/libphp5.so 后添加AddType application/x-httpd-php .php
可以 cp /app/apache/bin/apachectl /usr/bin/apache
以后,就可以使用以下命令简便操作了
apache stop
apache start
apache restart