求助:mysql如何连接php

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
show007good
帖子: 11
注册时间: 2006-03-02 18:47

求助:mysql如何连接php

#1

帖子 show007good » 2006-03-04 17:07

我尝试用mysql连接php,不过老是失败了。以下是出错的信息:
Fatal error: Call to undefined function mysql_pconnect() in /var/www/helloworld.php on line 7

请到底出现什么问题?
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#2

帖子 firehare » 2006-03-04 17:53

如果你要用PHP去连接的话,那么你得在PHP中加入 MySQL 支持呀!具体可以到Wiki或本版置顶帖去找相关内容!
我心无畏,源自于我心无知。
图片
show007good
帖子: 11
注册时间: 2006-03-02 18:47

#3

帖子 show007good » 2006-03-04 21:17

怎样配置那个php.ini文件,使它可以连接到数据库mysql
如下是php.ini的一部分。
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;

; UNIX: "/path1:/path2"
;include_path = ".:/usr/share/php"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"

; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
doc_root =

; The directory under which PHP opens the script using /~username used only
; if nonempty.
user_dir =

; Directory in which the loadable extensions (modules) reside.
; extension_dir = "./"

; Whether or not to enable the dl() function. The dl() function does NOT work
show007good
帖子: 11
注册时间: 2006-03-02 18:47

#4

帖子 show007good » 2006-03-04 22:03

#

另外,在装完php5后最好确认一下/etc/apache2/mods-enabled/下是否有链接:

php5.load -> /etc/apache2/mods-available/php5.load这句话的意思我不明白,谁可以为我解释一下?
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#5

帖子 firehare » 2006-03-05 11:45

你可以在源上直接下呀,这样的话,会自动给你装好的!
我心无畏,源自于我心无知。
图片
show007good
帖子: 11
注册时间: 2006-03-02 18:47

#6

帖子 show007good » 2006-03-05 19:51

终于装好了,在ubuntu下装软件真方便。
livesylvia
帖子: 47
注册时间: 2006-04-08 10:31
联系:

#7

帖子 livesylvia » 2006-04-21 11:40

apache已经支持PHP,MYSQL也可以运行了。

但是php加载mysql不成功,出现Fatal error: Call to undefined function mysql_pconnect()

怎么解决?
回复