Hi there!
I´ve installed the wkhtmltopdf toolkit in my shared host, and it worked. I´ve tested quite thoroughly and it worked just fine.
Now it doesn´t and I don´t understand why?
When I try to generate "some" pdfs (not all of them! sometimes it works), this error appears in a blank page:

Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (4, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:8680:\"MySQL server has gone away\nquery: INSERT INTO watchdog\n (uid, type, message, variables, severity, link, location, referer, hostname, timestamp)\n VALUES\n (4, 'print_pdf', 'wkhtmltopdf: Loading pages (1/5)\\n[> ] 0%\\r[======> ] 10%\\rWarning: Blocked access to file \\nWarning: Blocked access to file \\nWarning: Blocked access to file \\n[===============> ] 26%\\r[============================================================] 100%\\rReso in /home/union/public_html/includes/database.mysqli.inc on line 128
Unable to stream pdf: headers already sent
Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (4, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:339:\"MySQL server has gone away\nquery: UPDATE sessions SET uid = 4, cache = 1305140454, hostname = '200.114.148.130', session = 'node_overview_filter|a:0:{}og_last|s:4:\\"9530\\";user_overview_filter|a:0:{}dblog_overview_filter|a:0:{}', timestamp = 1305140546 WHERE sid = 'c68421e95712e4ab0907259b870af174'\";s:5:\"%file\";s:47:\"/home/union/public_html/includes/session.inc\";s:5:\"%line\";i:70;}', 3, '', 'http://www.union.com/printpdf/10196/all', 'http://www.union.com/consorcio/montevideo-2/liquidacion/10196', � in /home/union/public_html/includes/database.mysqli.inc on line 128

Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (4, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:84:\"MySQL server has gone away\nquery: UPDATE users SET access = 1305140546 WHERE uid = 4\";s:5:\"%file\";s:47:\"/home/union/public_html/includes/session.inc\";s:5:\"%line\";i:75;}', 3, '', 'http://www.union.com/printpdf/10196/all', 'http://www.union.com/consorcio/montevideo-2/liquidacion/10196', '200.114.148.130', 1305140546) in /home/union/public_html/includes/database.mysqli.inc on line 128

I´ve checked de log and this is what it shows:

Tipo	print_pdf
Fecha	Miércoles, 11 Mayo, 2011 - 15:12
Usuario	rosamunda
Ubicación	http://www.union.com/printpdf/recibos/12688
Referente	http://www.union.com/consorcio/demostraci%C3%B3n-115/liquidacion/12688
Mensaje	wkhtmltopdf: Loading pages (1/5) [> ] 0% [======> ] 10% Warning: Blocked access to file Warning: Blocked access to file Warning: Blocked access to file [=============> ] 23% [============================================================] 100% Resolving links (2/5) [============================================================] Page 1 of 1 Counting pages (3/5) [============================================================] Page 1 of 1 Printing pages (5/5) [> ] Preparing [===================> ] Page 1 of 3 [=======================================> ] Page 2 of 3 [============================================================] Page 3 of 3 Done
Severidad	aviso
Nombre del host	200.114.148.130
Operaciones	

I´m running print 6.1.12 version and it seems that the problem should have been solved... (Warning: Blocked access to file).

I´ve changed anything, nor installed nothing, and I´m quite puzzled about this! Please, any help will be very much appreciated!

Rosamunda

Comments

Rosamunda’s picture

I´m sorry, I meant that I haven´t changed anything in my installation....

Rosamunda’s picture

After checking inch by inch each file, I´ve discovered that one of my print.tpl files inside my theme folder didn´t have the modifications explained here. So I´ve chenged it and tested it again.
Then the errors are a little different:

Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (12, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:8436:\"MySQL server has gone away\nquery: INSERT INTO watchdog\n (uid, type, message, variables, severity, link, location, referer, hostname, timestamp)\n VALUES\n (12, 'print_pdf', 'wkhtmltopdf: Loading pages (1/5)\\n[> ] 0%\\r[======> ] 10%\\r[===============> ] 26%\\r[============================================================] 100%\\rResolving links (2/5) \\n[============================================================] Page 1 o in /home/union/public_html/includes/database.mysqli.inc on line 128
Unable to stream pdf: headers already sent
Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (12, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:248:\"MySQL server has gone away\nquery: UPDATE sessions SET uid = 12, cache = 0, hostname = '186.18.83.179', session = 'og_last|s:5:\\"12662\\";', timestamp = 1305173845 WHERE sid = 'd51b01d674bdede40f0b27c41e360e36'\";s:5:\"%file\";s:47:\"/home/union/public_html/includes/session.inc\";s:5:\"%line\";i:70;}', 3, '', 'http://www.union.com/printpdf/12688/all', 'http://www.union.com/consorcio/demostraci%C3%B3n-115/liquidacion/12688', '186.18.83.179', 1305173845) in /home/union/public_html/includes/database.mysqli.inc on line 128

Warning: MySQL server has gone away query: INSERT INTO watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (12, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:85:\"MySQL server has gone away\nquery: UPDATE users SET access = 1305173845 WHERE uid = 12\";s:5:\"%file\";s:47:\"/home/union/public_html/includes/session.inc\";s:5:\"%line\";i:75;}', 3, '', 'http://www.union.com/printpdf/12688/all', 'http://www.union.com/consorcio/demostraci%C3%B3n-115/liquidacion/12688', '186.18.83.179', 1305173845) in /home/union/public_html/includes/database.mysqli.inc on line 128

So I´ve went to my dev site wich is a copy of the working live site, and tested there. It works there perfectly fine (is the same shared hosting). The only difference is the performance: the dev site has all performance settings turn off, while the live site (the one that doesn´t work) has those performance settings on (cache: normal, page compression ON, Optimize CSS files ON, Optimize JavaScript files ON).

After trying again with the performance settings turned to OFF, the site will take forever to load. In fact, it won´t load at all. It keeps loadingd, forever. Literally.

Hope this enlights a bit about the core problem, if there is one...Any thoughts on this?
Many, many thanks in advance!
Rosamunda

Rosamunda’s picture

Status: Active » Fixed

I´ve solved the problem, but it´s kinda weird, because it´s about commenting
<?php //print $print['base_href']; ?> inside <head>.
After changing my template according to this the problem didn´t got solved. It only worked commenting that line.

I just wanted to add this solution here in case someone else get this issue aswell...
Cheers,
Rosamunda

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Rosamunda’s picture

Status: Closed (fixed) » Needs review

I would like to have some thoughts on this.. I mean it was just a coincidence? Was it a bug? Is somewhat a random thing that sometimes appears and sometimes doesn´t?

jcnventura’s picture

Status: Needs review » Postponed (maintainer needs more info)

@Rosamunda: what is the URL of your site and what was the value of the base_href line.

FYI: by removing that line and since the print page is usually in http://domain.tld/print/nid, whereas the normal page is usually in http://domain.tld/alias, if you specify images by relative path (ie < img src="images/nice.jpg" >), instead of getting the file from the correct place (http://domain.tld/images/nice.jpg) it will try to get them from a print-relative path(http://domain.tld/print/images/nice.jpg). This works fine for everyone else, which makes me think that you have a site-specific problem.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

No further info in 2 weeks. Closing the issue.