moodle file.php返回一个空白的0字节文件

时间:2023-02-05 13:00:09

For some reason one installation of Moodle 1.9.3+ has a problem that file.php returns a blank 0 byte file sometimes, even the apache log shows 0 bytes were returned. Another moodle installation works OK with the same htm files.

由于某种原因,Moodle 1.9.3+的一个安装有一个问题,即file.php有时会返回一个空白的0字节文件,即使apache日志显示返回了0个字节。另一个moodle安装可以使用相同的htm文件。

What could be causing this? Problematic files are just usual htm files - bug occurs with links like this:

可能是什么导致了这个?有问题的文件只是通常的htm文件 - 这样的链接会出现错误:

http://server/file.php/164/moddata/scorm/4/data/msg.htm

(The problematic moodle was upgraded from 1.8 version earlier)

(有问题的moodle从之前的1.8版本升级)

4 个解决方案

#1


A completely blank response may indicate a PHP error; check the PHP error log.

完全空白的响应可能表示PHP错误;检查PHP错误日志。

#2


I've had this with a recent XAMP install, it did it whenever a file was saved as UTF8 (which my Visual Studio was doing automatically). Worked on every install apart from my test XAMP box though.

我有一个最近的XAMP安装,只要文件保存为UTF8(我的Visual Studio自动执行),它就会这样做。除了我的测试XAMP盒之外,每次安装工作。

#3


I had some problems with loading binary files with file.php, I think it showed up incorrectly as being 0 bytes (but I'm not sure). Turned out to be an extra new line character in the beginning of the jpg-files, the reason was a extra new line in the config.php file after the finishing ?>

我在使用file.php加载二进制文件时遇到了一些问题,我认为它错误地显示为0字节(但我不确定)。原来在jpg文件的开头是一个额外的新行字符,原因是在完成后config.php文件中有一个额外的新行?>

I'm not a PHP-programmer but I've seen suggestions to remove the ending ?> in php-only files to minimize this kind of problem.

我不是PHP程序员,但我已经看到建议删除结尾?>在仅PHP文件中,以尽量减少这种问题。

Hope it helps. Johan Carlsson

希望能帮助到你。约翰卡尔森

#4


Deactivate all filtes of your moodle system and test again.

停用moodle系统的所有过滤器并再次测试。

#1


A completely blank response may indicate a PHP error; check the PHP error log.

完全空白的响应可能表示PHP错误;检查PHP错误日志。

#2


I've had this with a recent XAMP install, it did it whenever a file was saved as UTF8 (which my Visual Studio was doing automatically). Worked on every install apart from my test XAMP box though.

我有一个最近的XAMP安装,只要文件保存为UTF8(我的Visual Studio自动执行),它就会这样做。除了我的测试XAMP盒之外,每次安装工作。

#3


I had some problems with loading binary files with file.php, I think it showed up incorrectly as being 0 bytes (but I'm not sure). Turned out to be an extra new line character in the beginning of the jpg-files, the reason was a extra new line in the config.php file after the finishing ?>

我在使用file.php加载二进制文件时遇到了一些问题,我认为它错误地显示为0字节(但我不确定)。原来在jpg文件的开头是一个额外的新行字符,原因是在完成后config.php文件中有一个额外的新行?>

I'm not a PHP-programmer but I've seen suggestions to remove the ending ?> in php-only files to minimize this kind of problem.

我不是PHP程序员,但我已经看到建议删除结尾?>在仅PHP文件中,以尽量减少这种问题。

Hope it helps. Johan Carlsson

希望能帮助到你。约翰卡尔森

#4


Deactivate all filtes of your moodle system and test again.

停用moodle系统的所有过滤器并再次测试。