请教:关于linux下LAMP环境配置的问题——php连接mysql~
本帖最后由 nazziu 于 2011-03-21 15:31 编辑
本人linux菜鸟,接触linux10天左右,因工作需求匆忙上手,已经baidu+google了好几天,没有找到最终解决方案,烦请过路各位大侠多多指点~~
有关系统:Red Hat Enterprise Linux Server release 5.2,32位
前提条件:该主机在作为一个邮件服务器使用,使用tomcat+mysql。
想在该系统搭建LAMP环境,使用原来已有的mysql,又安装了apache、php、zend等。
遇到很多问题,查了很多资料,现系统环境已经配置得差不多了,apache服务能正常启动,.php页面也能正常访问。
但是,php的mysql扩展没有配置成功。通过phpize来修复mysql扩展的过程中,总是无法成功,config.log记录如下:
---------------------以下为config.log的内容-------------------------------------------------------------------------
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ ./configure --prefix=/usr/local/mysql --with-php-config=/usr/local/php/bin/php-config --with-mysql-dir=/home/coremail/mysql --with-zlib-dir=/usr/local/zlib
## --------- ##
## Platform. ##
## --------- ##
hostname = coremail
uname -m = i686
uname -r = 2.6.18-92.el5PAE
uname -s = Linux
uname -v = #1 SMP Tue Apr 29 13:31:02 EDT 2008
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = i686
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/kerberos/sbin
PATH: /usr/kerberos/bin
PATH: /usr/local/sbin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /root/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1489: checking for egrep
configure:1499: result: grep -E
configure:1504: checking for a sed that does not truncate output
configure:1558: result: /bin/sed
configure:1679: checking for gcc
configure:1695: found /usr/bin/gcc
configure:1705: result: gcc
configure:1949: checking for C compiler version
configure:1952: gcc --version </dev/null >&5
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-4
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:1955: $? = 0
configure:1957: gcc -v </dev/null >&5
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-4
configure:1960: $? = 0
configure:1962: gcc -V </dev/null >&5
gcc: '-V' option must have argument
configure:1965: $? = 1
configure:1988: checking for C compiler default output file name
configure:1991: gcc conftest.c >&5
configure:1994: $? = 0
configure:2040: result: a.out
configure:2045: checking whether the C compiler works
configure:2051: ./a.out
configure:2054: $? = 0
configure:2071: result: yes
configure:2078: checking whether we are cross compiling
configure:2080: result: no
configure:2083: checking for suffix of executables
configure:2085: gcc -o conftest conftest.c >&5
configure:2088: $? = 0
configure:2113: result:
configure:2119: checking for suffix of object files
configure:2140: gcc -c conftest.c >&5
configure:2143: $? = 0
configure:2165: result: o
configure:2169: checking whether we are using the GNU C compiler
configure:2193: gcc -c conftest.c >&5
configure:2199: $? = 0
configure:2203: test -z
|| test ! -s conftest.err
configure:2206: $? = 0
configure:2209: test -s conftest.o
configure:2212: $? = 0
configure:2225: result: yes
configure:2231: checking whether gcc accepts -g
configure:2252: gcc -c -g conftest.c >&5
configure:2258: $? = 0
configure:2262: test -z
|| test ! -s conftest.err
configure:2265: $? = 0
configure:2268: test -s conftest.o
configure:2271: $? = 0
configure:2282: result: yes
configure:2299: checking for gcc option to accept ANSI C
configure:2369: gcc -c -g -O2 conftest.c >&5
configure:2375: $? = 0
configure:2379: test -z
|| test ! -s conftest.err
configure:2382: $? = 0
configure:2385: test -s conftest.o
configure:2388: $? = 0
configure:2406: result: none needed
configure:2424: gcc -c -g -O2 conftest.c >&5
conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me'
configure:2430: $? = 1
configure: failed program was:
| #ifndef __cplusplus
| choke me
| #endif
configure:2564: checking whether gcc and cc understand -c and -o together
configure:2594: gcc -c conftest.c -o conftest.o >&5
configure:2597: $? = 0
configure:2599: gcc -c conftest.c -o conftest.o >&5
configure:2602: $? = 0
configure:2609: cc -c conftest.c >&5
configure:2612: $? = 0
configure:2615: cc -c conftest.c -o conftest.o >&5
configure:2618: $? = 0
configure:2620: cc -c conftest.c -o conftest.o >&5
configure:2623: $? = 0
configure:2641: result: yes
configure:2657: checking for system library directory
configure:2675: result: lib
configure:2683: checking if compiler supports -R
configure:2707: gcc -o conftest -g -O2 conftest.c -R /usr/lib >&5
gcc: unrecognized option '-R'
/usr/lib: file not recognized: Is a directory
collect2: ld returned 1 exit status
configure:2713: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:2740: result: no
configure:2745: checking if compiler supports -Wl,-rpath,
configure:2769: gcc -o conftest -g -O2 conftest.c -Wl,-rpath,/usr/lib >&5
configure:2775: $? = 0
configure:2779: test -z
|| test ! -s conftest.err
configure:2782: $? = 0
configure:2785: test -s conftest
configure:2788: $? = 0
configure:2802: result: yes
configure:2845: checking build system type
configure:2863: result: i686-pc-linux-gnu
configure:2871: checking host system type
configure:2885: result: i686-pc-linux-gnu
configure:2893: checking target system type
configure:2907: result: i686-pc-linux-gnu
configure:3005: checking for PHP prefix
configure:3007: result: /usr/local/php
configure:3009: checking for PHP includes
configure:3011: result: -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
configure:3013: checking for PHP extension directory
configure:3015: result: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613
configure:3017: checking for PHP installed headers prefix
configure:3019: result: /usr/local/php/include/php
configure:3063: checking for re2c
configure:3092: result: no
configure:3116: WARNING: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.
configure:3130: checking for gawk
configure:3147: found /usr/bin/gawk
configure:3157: result: gawk
configure:3209: checking for MySQL support
configure:3252: result: yes, shared
configure:3261: checking for specified location of the MySQL UNIX socket
configure:3279: result: no
configure:3289: checking for the location of libz
configure:3307: result: /usr/local/zlib
configure:3322: checking for MySQL UNIX socket location
configure:3358: result: /tmp/mysql.sock
configure:3526: checking for mysql_close in -lmysqlclient
configure:3556: gcc -o conftest -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql conftest.c -lmysqlclient >&5
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
(.text+0xdb): undefined reference to `compress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress':
(.text+0x16d): undefined reference to `uncompress'
collect2: ld returned 1 exit status
configure:3562: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define HAVE_MYSQL 1
| #define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char mysql_close ();
| int
| main ()
| {
| mysql_close ();
| ;
| return 0;
| }
configure:3588: result: no
configure:3798: checking for mysql_error in -lmysqlclient
configure:3828: gcc -o conftest -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql -Wl,-rpath,/usr/local/zlib/lib -L/usr/local/zlib/lib conftest.c -lmysqlclient >&5
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
(.text+0xdb): undefined reference to `compress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress':
(.text+0x16d): undefined reference to `uncompress'
collect2: ld returned 1 exit status
configure:3834: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| #define HAVE_MYSQL 1
| #define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char mysql_error ();
| int
| main ()
| {
| mysql_error ();
| ;
| return 0;
| }
configure:3860: result: no
configure:3874: error: mysql configure failed. Please check config.log for more information.
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=i686-pc-linux-gnu
ac_cv_build_alias=i686-pc-linux-gnu
ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_host=i686-pc-linux-gnu
ac_cv_host_alias=i686-pc-linux-gnu
ac_cv_lib_mysqlclient___mysql_close=no
ac_cv_lib_mysqlclient___mysql_error=no
ac_cv_objext=o
ac_cv_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=gcc
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_gcc_c_o=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_egrep='grep -E'
ac_cv_target=i686-pc-linux-gnu
ac_cv_target_alias=i686-pc-linux-gnu
lt_cv_path_SED=/bin/sed
php_cv_cc_dashr=no
php_cv_cc_rpath=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
AR=''
AWK='gawk'
CC='gcc'
CFLAGS='-g -O2'
CONFIGURE_COMMAND=' './configure' '--prefix=/usr/local/mysql' '--with-php-config=/usr/local/php/bin/php-config' '--with-mysql-dir=/home/coremail/mysql' '--with-zlib-dir=/usr/local/zlib''
CONFIGURE_OPTIONS=' '--prefix=/usr/local/mysql' '--with-php-config=/usr/local/php/bin/php-config' '--with-mysql-dir=/home/coremail/mysql' '--with-zlib-dir=/usr/local/zlib''
CPP=''
CPPFLAGS=''
CXXCPP=''
DEFS=''
ECHO='echo'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LN_S=''
LTLIBOBJS=''
MYSQL_INCLUDE=''
MYSQL_LIBS=''
MYSQL_MODULE_TYPE=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RE2C='exit 0;'
SED='/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME='so'
SHLIB_SUFFIX_NAME='so'
STRIP=''
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_RANLIB=''
ac_ct_STRIP=''
bindir='${exec_prefix}/bin'
build='i686-pc-linux-gnu'
build_alias=''
build_cpu='i686'
build_os='linux-gnu'
build_vendor='pc'
datadir='${prefix}/share'
exec_prefix='NONE'
host='i686-pc-linux-gnu'
host_alias='i686-pc-linux-gnu'
host_cpu='i686'
host_os='linux-gnu'
host_vendor='pc'
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='/usr/local/php'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target='i686-pc-linux-gnu'
target_alias=''
target_cpu='i686'
target_os='linux-gnu'
target_vendor='pc'
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define HAVE_MYSQL 1
#define MYSQL_UNIX_ADDR "/tmp/mysql.sock"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
configure: exit 1
---------------------config.log内容结束-------------------------------------------------------------------------
高人快来快快来快来啊~~
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
参考我这篇博文吧:
http://blog.sina.com.cn/s/blog_4b029ef301007xky.html
Linux下PHP开发环境搭建-php,mysql,apache
本帖最后由 nazziu 于 2011-03-24 15:42 编辑
回复 3# duanjigang
环境搭建的内容已经看过很多遍了,但始终没有找到解决我的问题的可行办法
楼上如果懂的话,还希望能看下我的问题,有针对性的提出有助于解决问题的建议哈
本帖最后由 duanjigang 于 2011-03-24 15:49 编辑
新建一个文件test.php
复制代码打开页面后,看能看到mysql的信息吗?
如图:
mysql.PNG (11.79 KB, 下载次数: 29)
下载附件
2011-03-24 15:49 上传
回复 5# duanjigang
看不到,应该是没有正确连接到服务器上已装的mysql
你还是先看点基础的资料吧。。。phpinfo和连接数据库没关系。
本帖最后由 nazziu 于 2011-03-24 16:23 编辑
回复 7# duanjigang
我是说php与mysql的通信连接。
我在网上有查到说phpinfo()里面没有出现mysql但是机器上面确实安装了mysql的话,应该是php的mysql扩展没有安装好
我贴出来的日志出错信息就是在用phpmize来安装mysql扩展过程中出现的
本帖最后由 nazziu 于 2011-03-24 16:20 编辑
configure:3556: gcc -o conftest -g -O2 -Wl,-rpath,/usr/lib/mysql -L/usr/lib/mysql conftest.c -lmysqlclient >&5
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_compress_alloc':
(.text+0xdb): undefined reference to `compress'
/usr/lib/mysql/libmysqlclient.a(my_compress.o): In function `my_uncompress':
(.text+0x16d): undefined reference to `uncompress'
collect2: ld returned 1 exit status
上面这些代码应该是这个日志值得研究、也是问题所在的问题吧,但我基础薄弱看不懂,不知道是什么意思?为什么会出现这种情况?
复制代码先看看mysql服务能正常访问吗?