I created a simple action in symfony that generates a PDF file through wkhtmltopdf and displays it in a browser.
Here is the code:
$response = $this->getResponse(); $response->setContentType('application/pdf'); $response->setHttpHeader('Content-Disposition', "attachment; filename=filename.pdf"); $response->setHttpHeader('Content-Length', filesize($file)); $response->sendHttpHeaders(); $response->setContent(file_get_contents($file)); return sfView::NONE;
This works fine in my local development environment - my browser receives the headers as expected, showing a download dialog.
Now I updated my test environment by running Apache 2.2.9-10 + lenny9 with PHP 5.3.5-0.dotdeb.0. If I now call this URL for the test environment, my browser will not receive custom set headers:
Date Mon, 07 Mar 2011 10:34:37 GMT Server Apache Keep-Alive timeout=15, max=100 Connection Keep-Alive Transfer-Encoding chunked
If I manually set them through header () in my action, Firebug will display the headers as expected. Does anyone know what could be wrong? Is it a symfony error or a problem with php or apache2 configuration? I do not understand.: -/
Thanks in advance!
teonanacatl
source share