I'm building a web app in CakePHP and I've intergrated PDF printing functionality to it using the CakePdf plugin, along with using the wkhtmltopdf binary.
I've done extensive testing on my local machine, and the code works and prints the PDF's as intended. However, when I then upload the app to my production web server, I get the following messages:
Warning (2): is_executable() [http://php.net/function.is-executable]: open_basedir restriction in effect. File(/usr/bin/wkhtmltopdf) is not within the allowed path(s): (/var/www/clients/client1/web1/web:/var/www/clients/client1/web1/tmp:/var/www/gravex.co.uk/web:/srv/www/gravex.co.uk/web:/usr/share/php5:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin) [APP/Plugin/CakePdf/Pdf/Engine/WkHtmlToPdfEngine.php, line 82]
wkhtmltopdf binary is not found or not executable: /usr/bin/wkhtmltopdf
Error: An Internal Error Has Occurred. Stack Trace
APP/Plugin/CakePdf/Pdf/Engine/WkHtmlToPdfEngine.php line 29 → WkHtmlToPdfEngine->_getCommand() APP/Plugin/CakePdf/Pdf/CakePdf.php line 234 → WkHtmlToPdfEngine->output() APP/Plugin/CakePdf/View/PdfView.php line 101 → CakePdf->output(string) CORE/Cake/Controller/Controller.php line 957 → PdfView->render(null, null) CORE/Cake/Routing/Dispatcher.php line 193 → Controller->render() CORE/Cake/Routing/Dispatcher.php line 161 → Dispatcher->_invoke(UsersController, CakeRequest, CakeResponse) APP/webroot/index.php line 96 → Dispatcher->dispatch(CakeRequest, CakeResponse)
I've checked the file that the CakePdf plugin uses to load wkhtmltopdf, and that path is /usr/bin/wkhtmltopdf as it is on my local machine. I've checked to see if wkhtmltopdf is located in the same place and it is. When installing wkhtmltopdf I simply extracted the binary and placed it in the said location, both on the local and production machines.
What can I do to fix this?
UPDATE
Following stix's advice, I have added the path to open_basedir, but I am still receiving this error. I have then tried to run wkhtmltopdf in the terminal, and I received the error "command not found". This turned out to be that the binary file was corrupt. So I've since uploaded a fresh version of the binary, and using ./wkhtmltopdf the binary works. If however I don't put the ./ before it, i still receive the error.