本文共 7950 字,大约阅读时间需要 26 分钟。
在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... yeschecking OpenSSL dir for SNMP... nochecking whether to enable UCD SNMP hack... nochecking for net-snmp-config... (cached) /usr/bin/net-snmp-configconfigure: 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:80no listening sockets available, shutting downUnable to open logs[root@redhat1 bin]#
解决方法:80端口被占用了,杀掉占用80端口的进程
错误8.没有指定主机IP地址
[root@redhat1 bin]# ./httpdhttpd: 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.访问网站时出现下载页面
解决方法:vim /usr/local/apache/conf/httpd.conf --加载php模块
LoadModule php5_module modules/libphp5.so
错误10.访问网站出现“could not find driver”,提示没有设备
解决方法:http://localhost/index.php
查看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-gnuconfigure: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 hereexports.c:2630: error: redefinition of 'ap_hack_apr_version'exports.c:1908: note: previous definition of 'ap_hack_apr_version' was hereexports.c:2631: error: redefinition of 'ap_hack_apr_version_string'exports.c:1909: note: previous definition of 'ap_hack_apr_version_string' was heremake[2]: *** [exports.lo] Error 1make[2]: Leaving directory `/root/httpd-2.4.9/server'make[1]: *** [all-recursive] Error 1make[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.confLoadModule 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... yeschecking for select... yesconfigure: 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... yeschecking for PDO includes... checking for PDO includes... /root/php-5.3.28/extchecking Oracle OCI support for PDO... nochecking for ODBC v3 support for PDO... nochecking for PostgreSQL support for PDO... yeschecking for pg_config... not foundconfigure: 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_fuIn 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 heremake: *** [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可以成功。
转载地址:http://rvcax.baihongyu.com/