[英]Internal Server Error readfile
I have a view-script which opens a pdf-file, it looks like follows: 我有一个可打开pdf文件的视图脚本,如下所示:
<?php
$this->title = 'arbeitskalender';
//ini_set('display_errors',1);
header('Content-Type:application/pdf');
header('Content-Disposition', 'attachment; fileName=arbeitskalender.pdf');
readfile('./pdfs/arbeitskalender.pdf');
?>
On my localhost (wamp-server) it works well and the file opens without any error, uploaded to my webspace (not my own server, only a webspace) I get 在我的本地主机(wamp-server)上,它运行良好,文件打开没有任何错误,并上传到我的网站空间(不是我自己的服务器,只有网站空间)
internal server error 内部服务器错误
. 。
What's the problem? 有什么问题? Is there a possibility to get a more informative error message? 是否有可能获得更详尽的错误消息? Because it is not my server, I can't have a look in the server log. 由于它不是我的服务器,因此无法查看服务器日志。
Yes, a lot of: 是的,很多:
Looking to your script: 查看您的脚本:
Check ./pdfs/arbeitskalender.pdf
permissions. 检查./pdfs/arbeitskalender.pdf
权限。 I guess it's not readable for apache
user 我想这对apache
用户不可读
I checked all your suggestions, I learned some more, but couldn't solve the problem. 我检查了您的所有建议,了解了更多信息,但无法解决问题。 I found another codesnippet which doesn't use readfile
and so far this works fine. 我发现了另一个不使用readfile
代码片段,到目前为止,它工作正常。
<?php
require_once 'Zend/Pdf.php';
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename=arbeitskalender.pdf');
header('Cache-Control: private, max-age=0, must-revalidate');
header('Pragma: public');
ini_set('zlib.output_compression','0');
echo file_get_contents("./pdfs/arbeitskalender.pdf");
?>
<html>
<body>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.