[字号:  ]

PHP出错...望高手们帮忙...3天了.....

发布时间:2008-8-19 10:44   作者: NIGHTKING   信息来源: PHPChina 开源社区门户
大前天设计主页留言系统的时候出错了,BAIDU和谷歌都查过了,尚未解决。天啊,就差那个留言了,前辈们救救急
调试结果就一句话: Fatal error: Call to undefined function: virtual() in
d:\usr\www\html\guest.php on line 1
1-67行如下:

本人用的是 Apache+PHP+MySQL服务器套件 v1.1.0
服务器系统:XP SP2    开发工具:Macromedia Dreamweaver 8
  大侠们帮帮忙看下吧...小生感激不尽.........

[ 本帖最后由 NIGHTKING 于 2008-8-19 11:22 编辑 ]

最新回复

laruence at 2008-8-19 10:46:55
....学点英文么

all to undefined function: virtual()   
virtual函数没有定义

可能是你没有讲定义这个函数的文件包含进来,
NIGHTKING at 2008-8-19 10:50:54
怎么解决....偶是小白....麻烦大侠出个方案......
七月十五 at 2008-8-19 10:55:02
apache的virtual相关模块没有被加载
第一句改成


[ 本帖最后由 七月十五 于 2008-8-19 10:56 编辑 ]
NIGHTKING at 2008-8-19 10:55:56
忘了贴,这是diskenth.php的内容:
<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_diskenth = "localhost";
$database_diskenth = "diskenth";
$username_diskenth = "root";
$password_diskenth = "";
$diskenth = mysql_pconnect($hostname_diskenth, $username_diskenth, $password_diskenth) or trigger_error(mysql_error(),E_USER_ERROR);
?>
wukewei00o at 2008-8-19 10:55:58
将virtual()改成include()或者require()试下吧,还有就是注意路径./为当前目录,../为上级目录
心痛 at 2008-8-19 11:01:50
virtual
(PHP 3, PHP 4, PHP 5)

virtual -- Perform an Apache sub-request
说明
bool virtual ( string filename )


virtual() is an Apache-specific function which is equivalent to <!--#include virtual...--> in mod_include. It performs an Apache sub-request. It is useful for including CGI scripts or .shtml files, or anything else that you would parse through Apache. Note that for a CGI script, the script must generate valid CGI headers. At the minimum that means it must generate a Content-type header.

To run the sub-request, all buffers are terminated and flushed to the browser, pending headers are sent too.

此函数仅在 PHP 作为 Apache 模块安装时才可使用
NIGHTKING at 2008-8-19 11:20:17
4楼的版主大大:偶把第一句改为<?require_once '/Connections/diskenth.php';?>后
调试得:
Warning: main(/Connections/diskenth.php): failed to open stream: No such file or directory in d:\usr\www\html\guest.php on line 1

Fatal error: main(): Failed opening required '/Connections/diskenth.php' (include_path='.;c:\php4\pear') in d:\usr\www\html\guest.php on line 1
改为<?php require_once('/Connections/diskenth.php'); ?>,调试得:
Warning: main(/Connections/diskenth.php): failed to open stream: No such file or directory in d:\usr\www\html\guest.php on line 1

Fatal error: main(): Failed opening required '/Connections/diskenth.php' (include_path='.;c:\php4\pear') in d:\usr\www\html\guest.php on line 1

假如把virtual()改成include(),页面和表单都能正常显示,但是留言后得:
Warning: main(/Connections/diskenth.php): failed to open stream: No such file or directory in d:\usr\www\html\guest.php on line 1

Warning: main(): Failed opening '/Connections/diskenth.php' for inclusion (include_path='.;c:\php4\pear') in d:\usr\www\html\guest.php on line 1

Notice: Undefined variable: database_diskenth in d:\usr\www\html\guest.php on line 40

Notice: Undefined variable: diskenth in d:\usr\www\html\guest.php on line 40

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in d:\usr\www\html\guest.php on line 40

Notice: Undefined variable: diskenth in d:\usr\www\html\guest.php on line 41

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in d:\usr\www\html\guest.php on line 41

假如把virtual()改成require(),调试后得:
Warning: main(/Connections/diskenth.php): failed to open stream: No such file or directory in d:\usr\www\html\guest.php on line 1

Fatal error: main(): Failed opening required '/Connections/diskenth.php' (include_path='.;c:\php4\pear') in d:\usr\www\html\guest.php on line 1

关于7楼大虾的答案....小生看不懂....
我用的是Apache v1.3.29 (Win32)    PHP v4.3.4 (Win32)  开发工具是Macromedia Dreamweaver 8

[ 本帖最后由 NIGHTKING 于 2008-8-19 11:24 编辑 ]
E网逍遥 at 2008-8-21 00:25:19
你的路径没有引入好,
如果是用DW的话,你的留言本页面应该是在根目录下。如果你的留言本在文件夹下,呵呵!应该:
require_once("Connections/diskenth.php");
xuzuning at 2008-8-21 09:06:16
<?php include('./Connections/diskenth.php'); ?>
xuer at 2008-8-21 09:17:29
不学英语,我也有什么办法?
ylcz at 2008-8-21 09:28:01
先搞好路径问题