I'm currently using the Symfony Process component, which relies on the proc_open
function of PHP. I need to launch a command to wkhtmltopdf
, which has this form :
/usr/local/bin/wkhtmltopdf --window-status "___RENDER_PDF___" --orientation "portrait" --run-script "window.basilOptions = {storages: ['memory'] }; document.body.addEventListener('status:app:rendered', function () { window.status = '___RENDER_PDF___'; });" "http://localhost/p/lps#poll/lpsp002" "/tmp/pdf_d6fbWO"`
When I run this command directly on my shell, it works just fine and takes about 6 seconds to be executed. But when I'm using PHP with the Process Component, it goes into a timeout... And when using the exec
or proc_open
functions, it runs indefinitely. The default timeout for the Process Component is 60 seconds (even extending it doesn't have any effect).
I tried this on PHP 5.4 and PHP 5.5, but the result seems to be same.
Any ideas why this command runs just fine on the shell but not through PHP ? Tested on MAMP and not MAMP environments (on 5.4 and 5.5 versions). It works on Ubuntu 14.04 with PHP 5.5 though.
I thought that maybe, when getting through PHP and MAMP, the process could be completed but still hangs as was reported with this bug ? I'll update when i'll have some more information, to see if the PDF is indeed generated or not.
Thanks.