I am not really into unix and that's why this thing is kind of weird for me.
The OS is CentOS 6.
I read nearly all topics concerning wkhtmltopdf, but my problem still exists. Actually it's not a wkhtmltopdf problem, but a permission problem.
To sum it up: wkhtmltopdf works in the command line, but not with php exec().
But wget works fine with php exec():
I can execute wkhtmltopdf in the command line, works fine:/usr/bin/wkhtmltopdf "test.de" "/var/www/html/test/test.pdf" 2>&1
I can execute wget with php, works fine:exec('/usr/bin/wget -O /var/www/html/test/test123.txt "test.de" 2>&1', $output, $return_var);
But I can NOT execute wkhtmltopdf with php:exec('/usr/bin/wkhtmltopdf "test.de" "/var/www/html/test/test.pdf" 2>&1', $output, $return_var);
this leads to "sh: /usr/bin/wkhtmltopdf: Permission denied"
I checked /usr/bin/wkhtmltopdf and compared it to /usr/bin/wget.
The permissions are the same: rwxr-xr-x or 0755
Even if I set chmod of /usr/bin/wkhtmltopdf to 777 and set the owner to apache, the error is still the same.
Perhaps it's a matter of yum?! Becauce I installed wget through yum and wkhtmltopdf not. That is the only difference I can think of.
I installed wkhtmltopdf with the following:
tar -vxjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
mv wkhtmltopdf-amd64 /usr/bin/wkhtmltopdf
chmod +x /usr/bin/wkhtmltopdf
Or could it be a problem with SELinux? I don't know very much about it, but I read through my research that "httpd_ssi_exec" and "httpd_execmem" might help and I put both to "yes", but the permission denied issue still exists.
So I wonder why does wget work with php and wkhtmltopdf does not? Hopefully someone can help me out and I can stop getting mad on this ;)
best regards, Alex
P.S.: test.de is http://test.de in my scripts, but I am not allowed to post more than two links.