免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2996 | 回复: 8
打印 上一主题 下一主题

[Web] 一直被apache,Mysql,php困扰的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-10-08 19:15 |只看该作者 |倒序浏览
我使用的是Fedore core3的linux操作系统,mysql apm方式安装的是mysql.5.0.7的版本,而apache 和PHP都是系统自带的版本分别为2.05 ,4.3.9所有配置均已经设置好,单独测试也都没问题,但是我所架设的一个网站里面有mysql数据库调用,此时系统就会提示:
  PHP Fatal error:  Call to undefined function:  mysql_connect() in /var/www/html/ddns_web/conn.inc on line 3

   很明显是PHP不支持mysql数据库调用,请问是什么原因?又如何解决呢?

我知道mysql 在4.1的版本之后认证方式已经改变,调用接口方式也应该改变,可是我已经解决了这个问题,不知道PHP和mysql的接口是不是要要变,难道非得要重新编译php吗 ? ./configure --with-mysql=          ?
   
php.ini中设置了:    mysql.default_socket = /usr/lib/mysql/mysql.sock
    是不是在php.ini中有什么关于mysql的没有包含进来? 该怎么作呢?

    请高手们分析一下原因,帮助解答一下,谢谢!

论坛徽章:
0
2 [报告]
发表于 2005-10-09 10:45 |只看该作者

一直被apache,Mysql,php困扰的问题

4.1以上最好使用MySQL Improved Extension

你也可以 试试通过加 --with-mysql  解决这个问题

论坛徽章:
0
3 [报告]
发表于 2005-10-09 10:56 |只看该作者

一直被apache,Mysql,php困扰的问题

刚才用 --with-mysql 重新编译了一下,还没成功.
这是我原来phpinfo() 的config信息,里面其实也是有--with-mysql的
PHP Version 4.3.9

System         Linux liuhu.domain.com 2.6.9-1.667 #1 Tue Nov 2 14:41:25 EST 2004 i686
Build Date         Oct 20 2004 14:53:02
Configure Command         './configure' '--build=i386-redhat-linux' '--host=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-mime-magic=/usr/share/file/magic.mime' '--with-apxs2=/usr/sbin/apxs'

论坛徽章:
0
4 [报告]
发表于 2005-10-09 11:01 |只看该作者

一直被apache,Mysql,php困扰的问题

把三个软件都从新编译一下吧.

论坛徽章:
0
5 [报告]
发表于 2005-10-09 13:57 |只看该作者

一直被apache,Mysql,php困扰的问题

mysql不动,而且是rpm方式安装的,重新编译apache和PHP如何? 因为mysql数据库对我现在太重要了,里面的数据都是重要信息.

论坛徽章:
0
6 [报告]
发表于 2005-10-09 14:15 |只看该作者

一直被apache,Mysql,php困扰的问题

Mysql的信息,可以备份嘛。

你只要重新编译PHP就行了。

apache要支持-enable-so

论坛徽章:
0
7 [报告]
发表于 2005-11-02 11:03 |只看该作者

致谢各位

很长时间没来了,大虾门一直教导菜鸟们不能只看贴不回贴,只问初级问题,而不先看前人已经归纳总结的问题,我想这都是初学者的误区.
我在论坛上问的问题,我已经解决了,感谢各位朋友的关注和支持,这里我也把我解决的过程拿出来和大家分享一下:
   我之前的问题是: apache+ php 环境下,在各种配置都正确的情况下,却不能联接数据库,具体现象见上文,我解决的办法是.大胆的重新编译了apache and PHP :

1.先装APACHE,再装PHP.
  安装版本请看总目录README

2.安装APACHE
  1) /usr/local/下新建文件夹apache
     cd /usr/local/apache/
  2) ./configure --prefix=/usr/local/apache -enable-so --enabel-cgi
              -with-config-file-path=/etc/
  3) make
  4) make install

  apache的配置请看网页php_apache_install.html
  守护进程:/usr/local/apache/bin/apachectl start/stop
  修改/etc/rc.d/init.d/httpd 启动文件
  /sbin/chkconfig --level 35 httpd on 设置开机自启动.

3.再装PHP
  1) /usr/local/下新建php
  2) cd /usr/local/php
  3) ./configure --prefix=/usr/local/php -with-mysql -with-config-file-path=..
                 -with-apxs2=/usr/local/apache/bin/apxs
     一定要加入对mysql的支持,配置文件放在他自己的目录下
  4) make
  5) make install

4.在/usr/local/php/htdocs/中 新建文件test.php
   <?php
     echo "test begin:";
     phpinfo();
   ?>
    测试信息是否显示准确,还可以写与数据库连接的脚本,测试与数据库连接是否正确.

论坛徽章:
0
8 [报告]
发表于 2005-11-04 00:16 |只看该作者
默认安装的apache有apsx文件吗 还有就是不用指定mysq的路径吗

论坛徽章:
0
9 [报告]
发表于 2005-11-04 09:55 |只看该作者

回chechi

默认安装的apache有apsx文件吗 还有就是不用指定mysq的路径吗
  with-mysql
   with-apxs2=/usr/local/apache/bin/apxs

mysql 不用指定路径,当然如果你知道你mysql 的路径,你也可以明确指出,我之所以未指出是因为我是以rpm 方式安装的mysql 没有明确的路径,但是完全有效

默认安装的apache  /configure --prefix=/usr/local/apache -enable-so --enabel-cgi
              -with-config-file-path=/etc/   
就会在/usr/local/apache/bin/apxs 下有apxs 文件,这个一定要加上去.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP