I have a view-script which opens a pdf-file, it looks like follows:
<?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
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. I guess it's not readable for apache
user
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.
<?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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.