分页: 1 / 1

求助:mysql如何连接php

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

请到底出现什么问题?

发表于 : 2006-03-04 17:53
firehare
如果你要用PHP去连接的话,那么你得在PHP中加入 MySQL 支持呀!具体可以到Wiki或本版置顶帖去找相关内容!

发表于 : 2006-03-04 21:17
show007good
怎样配置那个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

发表于 : 2006-03-04 22:03
show007good
#

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

php5.load -> /etc/apache2/mods-available/php5.load这句话的意思我不明白,谁可以为我解释一下?

发表于 : 2006-03-05 11:45
firehare
你可以在源上直接下呀,这样的话,会自动给你装好的!

发表于 : 2006-03-05 19:51
show007good
终于装好了,在ubuntu下装软件真方便。

发表于 : 2006-04-21 11:40
livesylvia
apache已经支持PHP,MYSQL也可以运行了。

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

怎么解决?