共计 2481 个字符,预计需要花费 7 分钟才能阅读完成。
总结一下用源代码安装 LAMP 环境中遇到常见的错误,从错误 3 开始是因为安装 php 后面带参数,导到没有找到开发包例如:./configure –with-gd –with-libjpeg 会出现如下错误。
1.checking for termcap functions library… configure: error: No curses/termcap library found
解决方法:yum install ncurses – 缺少 ncurses 安装包
2.1) 安装 gd 库出现以下错误:
In file included from /root/php-5.3.6/ext/gd/libgd/gd_compat.c:8:
/usr/local/jpeg/include/jpeglib.h:938: error: expected declaration specifiers or‘…’before‘FILE’
/usr/local/jpeg/include/jpeglib.h:939: error: expected declaration specifiers or‘…’before‘FILE’
make: *** [ext/gd/libgd/gd_compat.lo] Error 1
解决方法:vim php-5.3.6/ext/gd/libgd/gd_compat.c
#include <png.h> – 修改为 #include </usr/local/libpng/include/png.h>
#include <stdio.h> – 添加这行
3. Configure: error: xml2-config not found. Please check your libxml2 installation.
Solutions :
解决方法:yum install libxml2 libxml2-devel
4. Configure: error: Please reinstall the BZip2 distribution
Solutions :
解决方法:yum install bzip2 bzip2-devel
5. Configure: error: libjpeg.(also) not found.
Solutions :
解决方法:yum install libjpeg libjpeg-devel
6.Configure: error: libpng.(also) not found.
Solutions :
解决方法:yum install libpng libpng-devel
7.Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
Solutions:
解决方法:yum install mysql-devel
8. 没有安装 snmp 开发包
checking for SNMP support… yes
checking OpenSSL dir for SNMP… no
checking whether to enable UCD SNMP hack… no
checking for net-snmp-config… (cached) /usr/bin/net-snmp-config
configure: error: snmp.h not found. Check your SNMP installation.
[root@RedHat1 php-5.2.17]#
解决方法:yum install net-snmp net-snmp-devel
9.apache 端口被占用了
[root@redhat1 bin]# ./httpd
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[root@redhat1 bin]#
解决方法:80 端口被占用了, 杀掉占用 80 端口的进程
10. 没有指定主机 IP 地址
[root@redhat1 bin]# ./httpd
httpd: Could not reliably determine the server’s fully qualified domain name, using 2.2.2.117 for ServerName
[root@redhat1 bin]#
解决方法:vim /usr/local/apache/conf/httpd.conf
ServerName localhost – 添加这一行就可以了
10. 访问网站时出现下载页面
解决方法:vim /usr/local/apache/conf/httpd.conf – 加载 php 模块
LoadModule php5_module modules/libphp5.so
推荐阅读 :
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置 http://www.linuxidc.com/Linux/2013-06/86250.htm
CentOS 5.9 下编译安装 LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12) http://www.linuxidc.com/Linux/2013-03/80333p3.htm
RedHat 5.4 下 Web 服务器架构之源码构建 LAMP 环境及应用 PHPWind http://www.linuxidc.com/Linux/2012-10/72484p2.htm
LAMP 源码环境搭建 WEB 服务器 Linux+Apache+MySQL+PHP http://www.linuxidc.com/Linux/2013-05/84882.htm