编译安装apache+php,以及安装过程中的报错问题解决
2012-10-16 14:49
1001 查看
Linux下apache+php的配置:
文中用到的源码包版本:
httpd-2.2.23.tar.gz
php-5.4.7.tar.bz2
1.apache的安装
下载apache,我这里下载的是httpd-2.2.23.tar.gz源码包
命令列表:
tar -zxvf httpd-2.2.23.tar.gz -C ./
cd httpd-2.2.23
./configure --prefix=/usr/local/httpd-2.2.23/ --enable-module=so
make
make install
安装apache至/usr/local/httpd-2.2.23 并配置apache支持dso
2.下载安装php
下载php,我这里下载的是php-5.4.7.tar.bz2源码包
安装php之前,需要装一些依赖
yum -y install libxml2 libxslt gd-* libpng freetype
命令列表:
tar -jxvf php-5.4.7.tar.bz2 -C ./
cd php-5.4.7
./configure --prefix=/usr/local/php-5.4.7 --with-apxs2=/usr/local/httpd-2.2.23/bin/apxs(整合apache[可选]) --with-mysql=/usr/local/mysql (整合mysql[可选])
注:cp php.ini-dist /usr/local/lib/php.ini 【此步骤在本文中使用的php-5.4.7版本中,可以不用拷贝】
3.配置相关参数
对apache做如下配置
vim /usr/local/http-2.2.23/conf/httpd.conf
LoadModule php5_module modules/libphp5.so 添加php支持
AddType application/x-httpd-php .php
存盘退出
【如果不是php-5.4.7需要设置如下】:
vim /usr/local/lib/php.ini
#register-golbals=on
4.启动服务
/usr/local/httpd-2.2.23/bin/apachectl -k start
5、测试是否支持php
在htdocs目录下创建 index.php 写入:
<?php
echo phpinfo();
?>
保存退出后,直接访问: http://ip/index.php 即可!
报错处理:
报错1:
apache ./configure 报错:
configure: error: APR not found. Please read the documentation
经网上查阅资料才知道这是Apache的关联软件
在apr.apache.org网站上可以下载此软件(apr-1.4.5.tar.gz);编译安装完成后;本以为就可以相安无事的进行Apache的安装 ;没想到 突然间报了个
configure: error: APR-util not found. Please read the documentation
然后就下载apr-util-0.9.19.tar.bz2进行编译安装
安装完成后再次进行Apache的编译安装 没想到又报错了
configure: error: APR version 1.3.0 or later is required
真的怒了 又看了下 ,主要是因为apr版本过低造成的,应该卸载相关旧版本后
安装新版本 我又下载了 apr-util-1.3.12.tar.gz
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具体步骤如下:
1.解决apr not found问题——————>
[root@yahoo test]# tar -zxf apr-1.4.5.tar.gz
[root@yahoo apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@yahoo apr-1.4.5]# make
[root@yahoo apr-1.4.5]# make install
2.解决APR-util not found问题>>>>
[root@yahoo test]# tar -zxf apr-util-1.3.12.tar.gz
[root@yahoo apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[root@yahoo apr-util-1.3.12]# make
[root@yahoo apr-util-1.3.12]# make install
3.编译Apache
[root@yahoo httpd-2.3.12-beta]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
[root@yahoo httpd-2.3.12-beta]# make
[root@yahoo httpd-2.3.12-beta]# make install
[root@yahoo httpd-2.3.12-beta]# /usr/local/apache2/bin/apachectl start
报错2:
apache 出现 make[2]: *** [exports.lo] Error 1
类似于以下信息:
“exports.c:1653: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1022: error: previous definition of 'ap_hack_apr_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make: *** [all-recursive] Error 1”
在configure后加上 “--with-included-apr” 重新编译
再次make && make install即可
报错3:
启动apache时候报错:
./bin/apachectl -k start
httpd: apr_sockaddr_info_get() failed for sys.followme.com.cn
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
是因为apache 里ServerName与本地主机名不一致
将httpd.conf里的ServerName改成与主机名一致即可
将主机名更改为localhost.localdomain 也可。
3、apache 禁止显示目录列表的方法
A.在配置虚拟目录下设置参数为
Options FollowSymLinks
B.在配置虚拟目录下设置参数为
Options -Indexes FollowSymLinks
C.在根目录的 .htaccess 文件中输入(但此方法对所有的虚拟目录都起作用)
<Files *>
Options -Indexes
</Files>
同样也说一下显示目录列表的方法
A.在配置虚拟目录下设置参数为
Options Indexes FollowSymLinks
B.在配置虚拟目录下设置参数为
Options +Indexes FollowSymLinks
C.在根目录的 .htaccess 文件中找到此段,删除掉即可----不推荐
<Files *>
Options -Indexes
</Files>
本文出自 “Fate” 博客,请务必保留此出处http://yyzll.blog.51cto.com/4283444/1028342
文中用到的源码包版本:
httpd-2.2.23.tar.gz
php-5.4.7.tar.bz2
1.apache的安装
下载apache,我这里下载的是httpd-2.2.23.tar.gz源码包
命令列表:
tar -zxvf httpd-2.2.23.tar.gz -C ./
cd httpd-2.2.23
./configure --prefix=/usr/local/httpd-2.2.23/ --enable-module=so
make
make install
安装apache至/usr/local/httpd-2.2.23 并配置apache支持dso
2.下载安装php
下载php,我这里下载的是php-5.4.7.tar.bz2源码包
安装php之前,需要装一些依赖
yum -y install libxml2 libxslt gd-* libpng freetype
命令列表:
tar -jxvf php-5.4.7.tar.bz2 -C ./
cd php-5.4.7
./configure --prefix=/usr/local/php-5.4.7 --with-apxs2=/usr/local/httpd-2.2.23/bin/apxs(整合apache[可选]) --with-mysql=/usr/local/mysql (整合mysql[可选])
注:cp php.ini-dist /usr/local/lib/php.ini 【此步骤在本文中使用的php-5.4.7版本中,可以不用拷贝】
3.配置相关参数
对apache做如下配置
vim /usr/local/http-2.2.23/conf/httpd.conf
LoadModule php5_module modules/libphp5.so 添加php支持
AddType application/x-httpd-php .php
存盘退出
【如果不是php-5.4.7需要设置如下】:
vim /usr/local/lib/php.ini
#register-golbals=on
4.启动服务
/usr/local/httpd-2.2.23/bin/apachectl -k start
5、测试是否支持php
在htdocs目录下创建 index.php 写入:
<?php
echo phpinfo();
?>
保存退出后,直接访问: http://ip/index.php 即可!
报错处理:
报错1:
apache ./configure 报错:
configure: error: APR not found. Please read the documentation
经网上查阅资料才知道这是Apache的关联软件
在apr.apache.org网站上可以下载此软件(apr-1.4.5.tar.gz);编译安装完成后;本以为就可以相安无事的进行Apache的安装 ;没想到 突然间报了个
configure: error: APR-util not found. Please read the documentation
然后就下载apr-util-0.9.19.tar.bz2进行编译安装
安装完成后再次进行Apache的编译安装 没想到又报错了
configure: error: APR version 1.3.0 or later is required
真的怒了 又看了下 ,主要是因为apr版本过低造成的,应该卸载相关旧版本后
安装新版本 我又下载了 apr-util-1.3.12.tar.gz
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
具体步骤如下:
1.解决apr not found问题——————>
[root@yahoo test]# tar -zxf apr-1.4.5.tar.gz
[root@yahoo apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@yahoo apr-1.4.5]# make
[root@yahoo apr-1.4.5]# make install
2.解决APR-util not found问题>>>>
[root@yahoo test]# tar -zxf apr-util-1.3.12.tar.gz
[root@yahoo apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with- apr=/usr/local/apr/bin/apr-1-config
[root@yahoo apr-util-1.3.12]# make
[root@yahoo apr-util-1.3.12]# make install
3.编译Apache
[root@yahoo httpd-2.3.12-beta]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/
[root@yahoo httpd-2.3.12-beta]# make
[root@yahoo httpd-2.3.12-beta]# make install
[root@yahoo httpd-2.3.12-beta]# /usr/local/apache2/bin/apachectl start
报错2:
apache 出现 make[2]: *** [exports.lo] Error 1
类似于以下信息:
“exports.c:1653: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1022: error: previous definition of 'ap_hack_apr_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make: *** [all-recursive] Error 1”
在configure后加上 “--with-included-apr” 重新编译
再次make && make install即可
报错3:
启动apache时候报错:
./bin/apachectl -k start
httpd: apr_sockaddr_info_get() failed for sys.followme.com.cn
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
是因为apache 里ServerName与本地主机名不一致
将httpd.conf里的ServerName改成与主机名一致即可
将主机名更改为localhost.localdomain 也可。
3、apache 禁止显示目录列表的方法
A.在配置虚拟目录下设置参数为
Options FollowSymLinks
B.在配置虚拟目录下设置参数为
Options -Indexes FollowSymLinks
C.在根目录的 .htaccess 文件中输入(但此方法对所有的虚拟目录都起作用)
<Files *>
Options -Indexes
</Files>
同样也说一下显示目录列表的方法
A.在配置虚拟目录下设置参数为
Options Indexes FollowSymLinks
B.在配置虚拟目录下设置参数为
Options +Indexes FollowSymLinks
C.在根目录的 .htaccess 文件中找到此段,删除掉即可----不推荐
<Files *>
Options -Indexes
</Files>
本文出自 “Fate” 博客,请务必保留此出处http://yyzll.blog.51cto.com/4283444/1028342
相关文章推荐
- Linux apache+php编译安装以及报错解决
- 编译安装php问题以及解决方法
- 编译安装php容易出现的问题以及解决办法
- CentOs下安装Php的过程记录以及发现的问题和解决办法
- Fedora 15 降级安装GCC-4.5.3 全过程以及遇到的问题和解决办法总结
- 编译安装PHP 时遇到问题解决方法.
- AMH面板手工编译升级PHP5.6.9环境以及常见问题解决
- Ubuntu12.04编译Android4.0.1源码全过程-----附wubi安装ubuntu编译android源码硬盘空间不够的问题解决
- tomcat7源码编译过程以及问题解决
- PHP7.0编译安装ext/curl/.libs/ conflict 问题解决
- 编译安装PHP 时遇到问题解决方法.
- 源代码编译安装 PHP5.5.0,解决curl_exec訪问HTTPS返回502错误的问题
- Apache,PHP,MySql,WordPress初次安装的过程以及遇到的问题
- Mac上php和mysql的安装以及一些配置问题解决
- HIVE2的安装过程以及问题解决
- 邮件系统安装与使用过程中各种报错与问题的详细解决方法
- LAMP 1.4 PHP编译安装问题解决
- Ubuntu 12.04(32位)安装Oracle 11g(32位)全过程以及几乎所有问题的解决办法
- CocoaPods安装过程碰到得一系列问题以及如何解决
- 安装cacti过程中的各种报错以及解决方法