在Linux系统中安装LAMP出现的错误总结

本文涉及的产品
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
简介:

      在linux系统中使用源代码安装虽然是最好的,但但出现的问题也是最多的,现在我总结一下用源代码安装LAMP环境中遇到常见的错误,一般错误是没有安装依赖库文件所导致的.

 

错误1.checking for termcap functions library... configure: error: No curses/termcap library found

解决方法:yum install ncurses      --缺少ncurses安装包

 

错误2.安装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.

解决方法:yum install libxml2 libxml2-devel 

 

错误4. Configure: error: Please reinstall the BZip2 distribution

解决方法:yum install bzip2 bzip2-devel

 

错误5. Configure: error: libjpeg.(also) not found.

解决方法:yum install libjpeg libjpeg-devel

 

错误6.没有安装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

 

错误7.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端口的进程  

 

错误8.没有指定主机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          --添加这一行就可以了

 

错误9.访问网站时出现下载页面

151400980.jpg

解决方法:vim /usr/local/apache/conf/httpd.conf     --加载php模块

                   LoadModule php5_module        modules/libphp5.so

 

错误10.访问网站出现“could not find driver”,提示没有设备

解决方法:http://localhost/index.php

wKioL1LGmuLCQDAmAACqMEgGvzI262.jpg查看PDO中是否支持mysql数据库,如果不支持则编译安装要添加--with-pdo-mysql --with-pdo-pgsql   --without-pdo-sqlite,详细参数如下:

./configure --prefix=/usr/local/php-5.2.17 --with-apxs2=/usr/local/apache/bin/apxs  --with-mysql=/usr/local/mysql/  --with-mysqli=/usr/local/mysql/bin/mysql_config  --with-gd --with-jpeg-dir  --with-freetype-dir  --with-ldap --with-snmp --with-curl  --with-openssl  --enable-ftp  --enable-xml  --enable-mbstring --with-pdo-mysql --with-pdo-pgsql  --without-pdo-sqlite

 

错误11.提示没有apr包

checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... configure: error: --with-apr requires a directory or file to be provided
[root@node2 httpd-2.4.9]#

解决方法(需要安装apr包):

[root@node2]# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.1.tar.gz
[root@node2]# tar xvf apr-1.5.1.tar.gz
[root@node2]# cd apr*
[root@node2 apr]# ./configure --prefix=/usr/local/apr
[root@node2 apr]# make
[root@node2 apr]# make install
[root@node2 apr]# cd httpd-2.4.9
[root@node2 httpd-2.4.9]# ./configure --prefix=/usr/local/apache \
--enable-cache --enable-cache-disk  --enable-so   --enable-proxy  \
-enable-proxy-http  --enable-dav  --enable-cgi    --enable-rewrite \
-with-pcre --with-apr=/usr/local/apr/bin/apr-1-config

 

错误12.显示没有apr-util包

exports.c:1890: note: previous definition of 'ap_hack_apr_gid_get' was here
exports.c:2630: error: redefinition of 'ap_hack_apr_version'
exports.c:1908: note: previous definition of 'ap_hack_apr_version' was here
exports.c:2631: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1909: note: previous definition of 'ap_hack_apr_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/root/httpd-2.4.9/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/httpd-2.4.9/server'
make: *** [all-recursive] Error 1
[root@node2 httpd-2.4.9]#

解决方法:

[root@node2 ~]# wget http://apache.fayea.com/apache-mirror//apr/apr-util-1.5.3.tar.gz
[root@node2 ~]# tar xvf apr-util-1.5.3.tar.gz
[root@node2 ~]# cd apr-util-1.5.3
[root@node2 apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
[root@node2 ~]# cd httpd-2.4.9
[root@node2 httpd-2.4.9]# ./configure --prefix=/usr/local/apache \
--enable-cache --enable-cache-disk  --enable-so   --enable-proxy  \
--enable-proxy-http  --enable-dav  --enable-cgi    --enable-rewrite  \
--with-pcre --with-apr=/usr/local/apr/bin/apr-1-config  \
--with-apr-util=/usr/local/apr-util/      \
--加入这个选项--with-apr-util=/usr/local/apr-util/

 

错误13.apache服务启动正常,端口打不开

[root@node2 bin]# ./apachectl start
[root@node2 bin]# netstat -anp |grep :80
[root@node2 bin]# ./httpd
[root@node2 bin]# netstat -anp |grep :80
[root@node2 bin]#

解决方法:

[root@node2 bin]# vim ../logs/error_log      --从日志上看文件没有加载slotmem模块
[Tue Apr 29 12:05:02.234125 2014] [mpm_event:notice] [pid 653:tid 140181975127808] AH00491: caught SIGTERM, shutting down
[Tue Apr 29 12:05:07.320259 2014] [proxy_balancer:emerg] [pid 1239:tid 139638802343680] AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
[Tue Apr 29 12:05:07.320943 2014] [:emerg] [pid 1239:tid 139638802343680] AH00020: Configuration Failed, exiting
[Tue Apr 29 12:05:34.708499 2014] [proxy_balancer:emerg] [pid 1243:tid 140149584029440] AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
[Tue Apr 29 12:05:34.709235 2014] [:emerg] [pid 1243:tid 140149584029440] AH00020: Configuration Failed, exiting
[root@node2 bin]# vim ../conf/httpd.conf
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so    --打开这个模块
[root@node2 bin]# ./apachectl start
[root@node2 bin]# netstat -anp |grep :80     --成功了
tcp        0      0 :::80                       :::*                        LISTEN      1415/httpd
[root@node2 bin]#

 

错误14.安装php5.3.28出错

checking for poll... yes
checking for select... yes
configure: error:
+--------------------------------------------------------------------+
|                        *** ATTENTION ***                           |
|                                                                    |
| You've configured multiple SAPIs to be build. You can build only   |
| one SAPI module and CLI binary at the same time.                   |
+--------------------------------------------------------------------+
[root@node2 php-5.3.28]#

解决方法:

[root@node2 php-5.3.28]# ./configure  --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs  \
--with-mysql=/usr/local/mysql/      --with-zlib   --with-curl   \
--enable-dba  --enable-ftp   --with-jpeg-dir   --with-png-dir   \
--with-freetype-dir    --with-ldap     --enable-mbstring  \
--with-mcrypt   --with-mysqli=/usr/local/mysql/bin/mysql_config  \
--with-pdo-mysql    --with-pdo-pgsql     --without-pdo-sqlite   \
--with-pgsql   --with-pcre-dir    --enable-zip
--将enable-fpm和-with-apxs2=.......只须加一个就行了

 

错误15.缺少postgresql-devel包

checking for mysql_sqlstate... yes
checking for PDO includes... checking for PDO includes... /root/php-5.3.28/ext
checking Oracle OCI support for PDO... no
checking for ODBC v3 support for PDO... no
checking for PostgreSQL support for PDO... yes
checking for pg_config... not found
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
[root@node2 php-5.3.28]#

解决方法:

[root@node2 php-5.3.28]# yum install postgresql-devel
[root@node2 php-5.3.28]# yum install pdo*

 

错误16.在编译php5.3.28时出错

hp-5.3.28/ext/mbstring/libmbfl -I/root/php-5.3.28/ext/mbstring/libmbfl/mbfl -I/usr/local/mysql//include/mysql -I/usr/local/my3.28/Zend  -D_REENTRANT  -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS   -c /root/php-5.3.28/ext/standard/basic_fu
In file included from /root/php-5.3.28/ext/standard/basic_functions.c:49:
/root/php-5.3.28/Zend/zend_language_parser.h:317: error: conflicting types for ?.endparse?
/root/php-5.3.28/Zend/zend_globals_macros.h:35: note: previous declaration of ?.endparse?.was here
make: *** [ext/standard/basic_functions.lo] Error 1
[root@node2 php-5.3.28]#

解决方法:

把zend_language_parser.h文件中317行的内容int zendparse(void *)与zend_globals_macros.h 35行 int zendparse(void *compiler_globals);弄成一致。再进行make可以成功。

 










本文转自 z597011036 51CTO博客,原文链接:http://blog.51cto.com/tongcheng/1339336,如需转载请自行联系原作者
相关实践学习
如何快速连接云数据库RDS MySQL
本场景介绍如何通过阿里云数据管理服务DMS快速连接云数据库RDS MySQL,然后进行数据表的CRUD操作。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
打赏
0
0
0
0
235
分享
相关文章
Linux系统中的cd命令:目录切换技巧
踏过千山,越过万水,人生就是一场不断前行的旅程,总充满了未知与挑战。然而,“cd”命令如同你的旅伴,会带你穿梭在如棋盘一般的文件系统中,探索每一处未知。希望你能从“cd”命令中找到乐趣,像是掌控了一种络新妙的魔法,去向未知进发,开始你的探索之旅。
95 24
|
10天前
|
Linux系统下快速批量创建和删除文件的方法
总的来说,使用shell脚本来批量处理文件是一种非常强大的工具,只要你愿意花时间学习和实践,你会发现它能大大提高你的工作效率。
66 19
Linux系统之su命令的基本使用
Linux系统之su命令的基本使用
72 2
Linux系统之su命令的基本使用
在Ubuntu Linux系统下如何搭建并安装EDK2
以上就是在Ubuntu Linux系统下搭建并安装EDK2的过程。这个过程可能会有些复杂,但只要按照步骤一步步来,应该不会有太大问题。如果在过程中遇到任何问题,都可以在网上找到相应的解决方案。希望这个指南能对你有所帮助!
73 17
Linux数据库安装
本文介绍了在CentOS 8.0和Ubuntu 22.04系统上安装、配置和启动MariaDB数据库服务器的详细步骤。包括通过`yum`和`apt`包管理器安装MariaDB服务,启动并检查服务运行状态,设置root用户密码以及连接数据库的基本操作。此外,还展示了如何在Ubuntu上更新软件包列表、安装依赖项,并验证MariaDB的版本和运行状态。通过这些步骤,用户可以成功部署并初始化MariaDB环境,为后续数据库管理与应用开发奠定基础。
18 4
Oracle linux 8 二进制安装 MySQL 8.4企业版
Oracle linux 8 二进制安装 MySQL 8.4企业版
29 1
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
55 10
|
19天前
|
Linux安装Elasticsearch详细教程
Linux安装Elasticsearch详细教程
57 1
|
26天前
|
利用PHP压缩音频:Linux环境下的ffmpeg简易安装指南
希望这个指南能为你的编程之旅提供帮助。只需记住,每一行代码都像音乐的音符,组合在一起,创造出美妙的旋律。祝你编程愉快!
77 6
17.1 Linux LAMP环境搭建的前期准备
我们知道,如果我们安装的是应用服务软件,这个软件是给外网用户访问和使用的,那么应该使用源码包安装,因为源码包安装的软件经过了本机编译,性能更好。所以我们的 LAMP 环境搭建,在生产服务器上一般采用源码包进行安装,而不会使用 RPM 包进行安装,接下来我们要讲的也是采用源码包方式搭建 LAMP 环境。
176 0
17.1 Linux LAMP环境搭建的前期准备
下一篇
oss创建bucket