I use phantomJS to create PDF files in PHP through the shell ( shell_exec ). The script works fine on a production server, and also works great if I connect the PhantomJS command directly to my terminal.
But this does not work when I run the script in the local local environment. I am wondering if there is a problem with permissions. I will not dive into the specification of my local environment for now, as I assume this is a high-level problem ...
The command to be executed through shell_exec() :
/usr/local/bin/phantomjs --ignore-ssl-errors=true --debug=true ../scripts/renderTeamProfile.js https://127.0.0.1/app_dev.php/pdf/enterprise-lpc-enterprise/profile/render /private/var/tmp/pjsK2N16E.pdf
php code:
public function pdfResponse($url, $script, $remote_filename) { $tempFile = tempnam('/tmp', 'pjs'); // The extension specifies output format. Use pdf $tempFilePdf = $tempFile . '.pdf'; rename($tempFile, $tempFilePdf);
php pdf-generation phantomjs
Ben davidow
source share