Unable to create pdf using wkhtmltopdf in shared hosting with PHP code
in my shared hosting not able to create pdf using wkhtmltopdf
by using ssh client I can create pdf, the command i used in ssh is
"./wkhtmltopdf-amd64-0.12.4/bin/wkhtmltopdf-amd64 www.google.co.in test.pdf"
this working
in my PHP code, I used as
exec("./wkhtmltopdf-amd64-0.12.4/bin/wkhtmltopdf-amd64 www.google.co.in test.pdf");
it is not working
I tried exec("./public_html/wkhtmltopdf-amd64-0.12.4/bin/wkhtmltopdf-amd64 www.google.co.in test.pdf"); and by removing ./ also,
not working
Related
I have a "web site project". In my project I am using the php exec to use the ubuntu package PDFTK to manipulate pdf.
For example I have this line of code(php) in my model, I am using code igniter :
shell_exec('pdftk /var/www/html/IntegrSupCours/uploads/GKAG01_FR.pdf dump_data output /var/www/html/IntegrSupCours/uploads/bookmark.txt');
Indeed Im starting from /var/www to access to my pdf file, because I am on ubuntu.
But let's say that I am on a localhost ubuntu pc and I want to migrate my site on a online server what will happend if I am changing to that, because the url string in my shell exec to access at my pdf file will be different ?
First of all the remote online server that you are mentioning is a machine with some operating system like ubuntu installed on it.
Also, the path that you are specifying is a path that is generally used by most of the web servers.
It is all about where you are installing your application on the online server. If you install the application at the same location as it is in your local, you will be able to see the pdf file in the online server too.
i have started making my own site where i want to use PHPMailer!.First of all i installed PHPMailer via Composer(cmd) on my desktop then used localhost to run my page where the PHPMailer was running just fine.I then tried to just transfer my page files and files that were generated in there from PHPMailer (those are:vendor directory ,composer.json,composer.lock) to FTP.When i tried running it on live page it didn't work and threw Error:
Fatal error: require(): Failed opening required '/www/sites/0/site25740/public_html/vendor/composer/ClassLoader.php'
(include_path='.:/usr/share/php:/usr/local/zend/share/ZendFramework/library') in
/www/sites/0/site25740/public_html/vendor/composer/autoload_real.php on line 12
I think that my problem is that i generated those files into my desktop directory and therefore they are not working on live page.
Is there any way to maybe generate those files on my FTP server or maybe changing the structure of those files to work on live page?
You need to use SSH not FTP.
Once you SSH into your server, you can run the composer install command to install dependencies the same as you have on your desktop.
[Edit] An FYI - Yes, we can upload the vendor folder. Composer is a deployment tool. Uploading a vendor folder is NOT using a deployment tool.
If I am deploying 100 applications - and uploading 50mb of dependencies 100 times from a branch office on a cable/dsl ... how fast & efficient is that? If we offload that 50mb download to the server, how fast is that?
We have an option to do deployments wrong, or to do deployments properly.
I do not condone doing it wrong. It's clearly an option, however it is wrong.
I've spent hours on this problem and still got nothing. I'm quite a noob when it comes to installing something rather than double clicking may that's why i'm stuck.
What i want to do is to develop a web service which takes a url and returns an image file of the screen shot of that url.
I found out that i can do this doing the following steps:
Using wkhtmltopdf to convert my html files to pdf
And then converting this pdf to image using php imagic library.
I'm still on the first step. I downloaded an executable for wkhtmltopdf from some website and by using the following lines in command line, i successfully created a pdf:
\"C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf\" --page-width 300 --page-height 225 \"$url\" $dir\\$tempName.pdf &
But now i wanted to make this as a web service online but this lines just run on cmd, not on a shared hosting server. What to do know? I've also seen phpwkhtmltopdf but i don't understand the installation phase as disscused Here.
I'm on the propel website now (http://www.propelorm.org/wiki/Documentation/1.5/Installation), and as I expected, there's a lot of command-line instructions for installing it, but how do I get it to work on my www.winhost.com server? Do I just upload the propel folder, and that's it?
Just download the tarball available at the download page (http://files.propelorm.org/propel-1.5.5.tar.gz) and extract it on your web space. More instructions can be found in the tarball in the INSTALL file :)
If you can't run a command line on your server, you can generate the model files on your local computer and upload them. You only need the runtime part of the Propel installation on your server, the generator part is only used for creating the files.
I have installed Drupal 6 and have the "Printer, e-mail and PDF versions" aka "Print" module installed.
I then realized in order to generate PDF's from my html nodes that I need a third-party tool, which is fine but the Print module is not recognizing the third-party tools I have installed in the /modules/print/lib/ directory. I get the following error in the "Home › Administer › Site configuration › Printer, e-mail and PDF versions" page:
"No PDF generation tool found! Please dowload a supported PHP PDF generation tool. Check this module's INSTALL.txt for more details."
I have set 755 permissions on the folders and files for the third-party tools, as most of my other settings are set to that as well.
I have installed two of the three recommended third-party PHP PDF generating tools:
1) http://dompdf.googlecode.com/files/dompdf-0.5.1.zip
2) http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.8.3.tar.bz2
Why am I seeing the "No PDF generation tool found! Please dowload a supported PHP PDF generation tool. Check this module's INSTALL.txt for more details." error message? And why is the Print module not recognizing my third-party tools?
Hm, just tried locally and it works for me, so you should double check your setup:
The module tries to find the installed libraries via the _print_pdf_tools() function in print_pdf.admin.inc. The function searches for a specific 'key' file per possible library in two places (assuming that if that file is ther, the whole library will be there as well):
in 'sites/all/libraries'
in the directory of the print module (should be 'modules/print' in your case)
It searches those directories recursively, so it should find them in arbitrary subdirectories as well, and the actual naming of the library directories should not matter.
Taking dompdf as an example here - it will be identified by its dompdf_config.inc.php file.
So you should check:
that this file is really present in the directory where you extracted dompdf to (from your comments, this should be modules/print/lib/dompdf-0.5.1)
that it is readable for your webserver process (you said you changed the permissions - did you do this recursively, and did you adjust the owner and/or group as well?)
The 'key' files used for identifying the other two libraries would be:
tcpdf.php for TCPDF
wkhtmltopdf or wkhtmltopdf.exe for wkhtmltopdf
Just checking - did you extract the libraries from the archives?
The folder would look like /sites/all/modules/print/lib/dompdf for example
wkhtmltopdf:
(Linux) No longer requires an XServer to be running (however the X11 client libs must be installed)
I am 85% sure that Dreamhost doesn't have X11 client libs on their shared hosting; you should have got errors while trying to compile wkhtmltopdf on dreamhost. By the way, try running uname -a in SSH session to dreamhost to find out their OS.
If you did manage to make wkhtmltopdf work on your local test server (which involves compiling the source tarball you linked to), you may have some luck using a pre-compiled static binary version from http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.8.3-static.tar.bz2
dompdf
The only thing dompdf requires is fonts. Have you followed the INSTALL instructions? If yes - try running some conversion with command-line, to see which errors prevent it from functioning. You haven't provided enough information to diagnose this one.