Search code examples
phppdfwkhtmltopdf

WKHTMLTOPDF PHP Hostgator CentOS 6 x64


I have downloaded the newest copy of wkhtmltopdf and put it in my cgi-bin folder on a hostgator server to which was provided for me for a small web application. I am able to execute

/home/{user_name}/public_html/cgi-bin/usr/local/bin/wkhtmltopdf http://google.com /home/{user_name}/public_html/hello.pdf

and this works just fine from the ssh console. But when I try the above in php with

$cmd = "/home/{user_name}/public_html/cgi-bin/usr/local/bin/wkhtmltopdf http://google.com /home/{user_name}/public_html/hello.pdf 2>&1"; 
$t = exec ($cmd, $output); 
var_dump ($output);

I get the following output

array(2) { [0]=> string(19) "Loading pages (1/6)" [1]=> string(132) "[> ] 0% [======> ] 10%" }

This makes no sense to me. It must be a php configuration or some other host gator security default. Please can someone shed some light on this, I am banging my head against a wall here.


Solution

  • Just wanted to post the answer that I had found for myself based on the specifics of the question, and the account in question, at the date of the posting, my comment was indeed the answer

    "I hate to be the bearer of bad news, but you will need to upgrade your account or do what I did and switch services to Digital Ocean, or another provider of your liking that will give you more control. Flat out php permission issue with a shared account or w.e. it was and hostgator support service IMHO is not very helpful what so ever. The men I spoke with new very little about what I would expect them to know at a basic technical level. So that was my solution unfortunately."

    Anyone else facing this issue, I highly recommend using another service, You would indeed need to upgrade your account from shared.