[SOLVED] WKHTMLTOPDF - still not updated!

Remove the exec() and shell_exec() functions from disable_functions in php.ini.
This will allow the binary execution of wkhtmltopdf

1 Like

There are no such parameterā€™s in php.ini

This was my issue with wkhtmltopdf, but if you donā€™t have it, then your issue with wkhtmltopdf is something else.

Should be something like this in php.ini file
disable_functions = ā€œexec, shell_exec, systemā€

Removing this would look like this
disable_functions = ā€œsystemā€

It enables exec and shell_exec which was needed to execute wkhtmltopdf

1 Like

Apologies. I see it now

How do you manage the php when updating your apps? Is it overstorten every time?

Not sure I understand the question!

Thank you so much, this way it works. :grinning:

Hola Roberto:

My app donā€™t open the PDF file in the Grid and have the Error creating PDF file, contact technical support..

I have Ubuntu 20.04.04 with the Scriptcase latest version 9.10.10(73) Please can you tell me how to fix it? I check php.ini and the disable_functions= ā€˜is OKā€™. Also i did sudo apt-get -y install wkhtmltopdf in my server and still not working.

Thanks for let me knowā˜ŗ

Jose

Hola Jose

Yo tuve el mismo problema y lo arregle con los permisos de la carpeta wkhtmltopdf que estĆ” en _lib/prod/third, habilitando los permisos de escritura.
espero te sirva

1 Like

Mil Gracias. Soy nuevo en Linux y no lo veo pero sigo buscando gracias por la informacion. Yo hice este comando para la installacion sudo apt-get -y install wkhtmltopdf es correcto?

Gracias Miguel

Jose

Hola, JosƩ:
la carpeta que comentaba @miguelk se encuentra dentro de la carpeta que genera scriptcase con el proyecto. Si el despliegue del proyecto desde sc lo has hecho incluyendo el entorno de producciĆ³n, es ahĆ­ donde tienes que buscar la carpeta _lib/prod/third/wkhtmltopdf/ y habilitarle los permisos de escritura.

This is back in version 9.10.022 (10)
It works fine in development environment, but not on the server.
Iā€™ve updated the prod environment to the latest version AND changed the folder permissions (old problem) and checked the PHP.ini (old problem)ā€¦ it still fails with the stupid non-specific error.

Iā€™ve given up on this and am now removing it from all my menus.

My clients think we are incompetentā€¦ Iā€™m damn sure we have less regard for the Scriptcase developers in this space. Its unnecessary and if you are going to use an external library, then you ned to make sure it works out of the boxā€¦ not after hours of fiddling.

What is the OS? Some hostings are moving from Centos to Rocky or Alma Linux.

Red Hat Linuxā€¦ donā€™t recall version and am not in office.

EDIT: details:
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.114.2.el7.x86_64
Architecture: x86-64

There are different flavours of wkhtmltopdf for the different versions of Unix
Its not clear what subdirectory is used for Centos 7 but running it in the Centos8 subdirectory you get:
When I run the log file I get a missing library error:

./wkhtmltopdf-amd64: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

If it is the linux-amd64 subdirectory then I get
Loading pages (1/6)
QSslSocket: cannot resolve CRYPTO_num_locks ] 10%
QSslSocket: cannot resolve CRYPTO_set_id_callback
QSslSocket: cannot resolve CRYPTO_set_locking_callback
QSslSocket: cannot resolve sk_free
QSslSocket: cannot resolve sk_num
QSslSocket: cannot resolve sk_pop_free
QSslSocket: cannot resolve sk_value
QSslSocket: cannot resolve SSL_library_init
QSslSocket: cannot resolve SSL_load_error_strings
QSslSocket: cannot resolve SSLv23_client_method
QSslSocket: cannot resolve SSLv23_server_method
QSslSocket: cannot resolve X509_STORE_CTX_get_chain
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_noconf
QSslSocket: cannot resolve OPENSSL_add_all_algorithms_conf
QSslSocket: cannot resolve SSLeay
QSslSocket: cannot call unresolved function CRYPTO_num_locks
QSslSocket: cannot call unresolved function CRYPTO_set_id_callback
QSslSocket: cannot call unresolved function CRYPTO_set_locking_callback
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function SSLv23_client_method
QSslSocket: cannot call unresolved function sk_num
Segmentation fault

There is a set of if/else statements in the grids index php which use strtolower(php_uname()) to get the local unix version and this then picks the relevant directory to useā€¦ in my case it looks like it should be linux-amd64, so the last error applies.

I really donā€™t have the time or energy to deal with these kinds of issues. It clearly hasnā€™t been tested on all of these permutations.

More information for thisā€¦
Version
if I key wkhtmltopdf -v
My wkhtmltopdf is wkhtmltopdf 0.12.6 (with patched qt)

The log file command is:

./wkhtmltopdf-amd64 --page-size Letter --orientation Portrait --header-right ā€œ[page]ā€ --disable-local-file-access https://idmb.uk/Webapps/myapps/_lib/tmp/sc_grid_Issues_html_a11ea0559855be3839f42889f2b1fffa.html /home/sites/1a/mysite/public_html/Webapps/myapps/_lib/tmp/sc_pdf_239f29c9b7adbbe8d98f4aa86d603daf_grid_Issues.pdf

Gives the QsslSocket error in my reply above.

if I try and check wkhtmltopdf-amd64 using a version command: wkhtmltopdf-amd64 -v
I get a command not found error.

If I manually adjust the .log output to remove the -amd64 bits:

wkhtmltopdf --page-size Letter --orientation Portrait --header-right "[page]" --disable-local-file-access https://idmb.uk/Webapps/myapps/_lib/tmp/sc_grid_Issues_html_a11ea0559855be3839f42889f2b1fffa.html /home/sites/1a/e/mysite/public_html/Webapps/myapps/_lib/tmp/sc_pdf_239f29c9b7adbbe8d98f4aa86d603daf_grid_Issues.pdf

It works (albeit with some canā€™t find image errors) and generates a pdf in the relevant location.

Because I donā€™t know the internal logic and structures of scriptcase, Iā€™m unsure of why the command is using wkhtmltopdf-amd64, rather than the more normal wkhtmltopdf, then I am stuck.

What I can say is that the problem is still not solved, but Iā€™m hoping the above gives NM some clues!

Iā€™ve tried various things to make this work (such as copying old configs or individual files), but I still canā€™t get this to work. Unfortunately I donā€™t have root or sudo access on my host, (And Iā€™m not a hosing/server specialist) so I canā€™t easily do a proper install from scratch.

The binary listed in the help /forum systems goes to an unknown page.

Can anybody provide me with a centos 7 version of wkhtmltopdf, that can be installed without sudo or root. Iā€™ve looked, but am unsure what I am looking for.

NB I have tried to update my prod environment both by updating it from the downloads page and by generating a single app with the production system. Neither solve the problem . I have also updated the production environment from the new options in the production environment itself after login. Nada.

I am sorry for late reply. In the meantime i had a new problem with pdf - especially export.
I cant export charts as pdf.

Just had several conversations with scriptcase/debug.

There was probably a change in the script case prod.

Previously it was necessary to specify the correct hostname as the command is

ā€œurlā€ā€¦/wkhtmltopdf ā€¦

If you had now entered ip 127.0.0.1 in the prod-settings/php/pdf server and the url was ā€œwww.test.com/ā€¦ā€; this resulted in an error because wkhtml was not found.
The correct DNS name had to be entered here.
Or it had to be changed accordingly in the hosts of the server ā€œ127.0.0.1 www.test.comā€.

However, there was obviously a change with Prod 1.0.001 Devel 9.10.023.

I generate charts in an app - these are produced as pdf - but without content. You can only see the background.
So it works - halfway.

After a long searchā€¦ and testing:

If you leave the pdf server ip empty it works all of a sudden!

Try that!

Edit: I have tested the DNS settings. These are still valid, otherwise sc wkthml will not find them.
Only no IP may be entered.
So it seems - itā€™s a bug ;).

Hmm. Iā€™m not sure you are describing the same problem. Iā€™ve never used a separate IP address for the PDF generation. (Presumably you mean the PDF Server IP in the prod environment?)

It works fine on the Dev environment (127.0.0.1).

Iā€™m not using the PDF generator appā€¦ just the Export function on the normal grid.

Thanks anyway.