Error with tcpdf ( Can't open image file: /tmp/jpg_jLtgvQ )

Hello, when tryiing to create PDF report i receive these errors:


Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: open_basedir restriction in effect. File(/tmp/jpg_jLtgvQ) is not within the allowed path(s): (/var/www/clients/client7/web10/web:/var/www/clients/client7/web10/tmp:/usr/share/php5) in /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php on line 7545 

Backtrace -->
#0 Piwik_ErrorHandler(2, imagepng() [<a href='function.imagepng'>function.imagepng</a>]: open_basedir restriction in effect. File(/tmp/jpg_jLtgvQ) is not within the allowed path(s): (/var/www/clients/client7/web10/web:/var/www/clients/client7/web10/tmp:/usr/share/php5), /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php, 7545, Array ([image] => Resource id #201,[tempname] => /tmp/jpg_jLtgvQ))#1 imagepng(Resource id #201, /tmp/jpg_jLtgvQ) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7545]#2 TCPDF->_toPNG(Resource id #201) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7322]#3 TCPDF->Image(/var/www/clients/client7/web10/web/piwik/plugins/UserSettings/images/browsers/FF.gif, 12, 39,53875, 4) called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:240]#4 Piwik_PDFReports_PDFRenderer->paintReportTable() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:172]#5 Piwik_PDFReports_PDFRenderer->paintReport() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/API.php:284]#6 Piwik_PDFReports_API->generateReport(1, 2011-02-08, 1, , 1, day)#7 call_user_func_array(Array ([0] => Piwik_PDFReports_API Object ([] => Array ()),[1] => generateReport), Array ([0] => 1,[1] => 2011-02-08,[2] => 1,[3] => ,[4] => 1,[5] => day)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Proxy.php:150]#8 Piwik_API_Proxy->call(Piwik_PDFReports_API, generateReport, Array ([token_auth] => 2f855385ea79a4a57dc12cf86813d5d9,[module] => API,[action] => index,[idSite] => 1,[period] => day,[date] => 2011-02-08,[method] => PDFReports.generateReport,[idReport] => 1,[outputType] => 1,[filter_limit] => 50)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Request.php:117]#9 Piwik_API_Request->process() called at [/var/www/clients/client7/web10/web/piwik/plugins/API/Controller.php:27]#10 Piwik_API_Controller->index()#11 call_user_func_array(Array ([0] => Piwik_API_Controller Object ([] => API,[] => ,[] => ,[] => 1,[] => ),[1] => index), Array ()) called at [/var/www/clients/client7/web10/web/piwik/core/FrontController.php:125]#12 Piwik_FrontController->dispatch() called at [/var/www/clients/client7/web10/web/piwik/index.php:60]


Warning: imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Invalid filename in /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php on line 7545 

Backtrace -->
#0 Piwik_ErrorHandler(2, imagepng() [<a href='function.imagepng'>function.imagepng</a>]: Invalid filename, /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php, 7545, Array ([image] => Resource id #201,[tempname] => /tmp/jpg_jLtgvQ))#1 imagepng(Resource id #201, /tmp/jpg_jLtgvQ) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7545]#2 TCPDF->_toPNG(Resource id #201) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7322]#3 TCPDF->Image(/var/www/clients/client7/web10/web/piwik/plugins/UserSettings/images/browsers/FF.gif, 12, 39,53875, 4) called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:240]#4 Piwik_PDFReports_PDFRenderer->paintReportTable() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:172]#5 Piwik_PDFReports_PDFRenderer->paintReport() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/API.php:284]#6 Piwik_PDFReports_API->generateReport(1, 2011-02-08, 1, , 1, day)#7 call_user_func_array(Array ([0] => Piwik_PDFReports_API Object ([] => Array ()),[1] => generateReport), Array ([0] => 1,[1] => 2011-02-08,[2] => 1,[3] => ,[4] => 1,[5] => day)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Proxy.php:150]#8 Piwik_API_Proxy->call(Piwik_PDFReports_API, generateReport, Array ([token_auth] => 2f855385ea79a4a57dc12cf86813d5d9,[module] => API,[action] => index,[idSite] => 1,[period] => day,[date] => 2011-02-08,[method] => PDFReports.generateReport,[idReport] => 1,[outputType] => 1,[filter_limit] => 50)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Request.php:117]#9 Piwik_API_Request->process() called at [/var/www/clients/client7/web10/web/piwik/plugins/API/Controller.php:27]#10 Piwik_API_Controller->index()#11 call_user_func_array(Array ([0] => Piwik_API_Controller Object ([] => API,[] => ,[] => ,[] => 1,[] => ),[1] => index), Array ()) called at [/var/www/clients/client7/web10/web/piwik/core/FrontController.php:125]#12 Piwik_FrontController->dispatch() called at [/var/www/clients/client7/web10/web/piwik/index.php:60]


Warning: fopen() [<a href='function.fopen'>function.fopen</a>]: open_basedir restriction in effect. File(/tmp/jpg_jLtgvQ) is not within the allowed path(s): (/var/www/clients/client7/web10/web:/var/www/clients/client7/web10/tmp:/usr/share/php5) in /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php on line 7611 

Backtrace -->
#0 Piwik_ErrorHandler(2, fopen() [<a href='function.fopen'>function.fopen</a>]: open_basedir restriction in effect. File(/tmp/jpg_jLtgvQ) is not within the allowed path(s): (/var/www/clients/client7/web10/web:/var/www/clients/client7/web10/tmp:/usr/share/php5), /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php, 7611, Array ([file] => /tmp/jpg_jLtgvQ))#1 fopen(/tmp/jpg_jLtgvQ, rb) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7611]#2 TCPDF->_parsepng(/tmp/jpg_jLtgvQ) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7549]#3 TCPDF->_toPNG(Resource id #201) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7322]#4 TCPDF->Image(/var/www/clients/client7/web10/web/piwik/plugins/UserSettings/images/browsers/FF.gif, 12, 39,53875, 4) called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:240]#5 Piwik_PDFReports_PDFRenderer->paintReportTable() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:172]#6 Piwik_PDFReports_PDFRenderer->paintReport() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/API.php:284]#7 Piwik_PDFReports_API->generateReport(1, 2011-02-08, 1, , 1, day)#8 call_user_func_array(Array ([0] => Piwik_PDFReports_API Object ([] => Array ()),[1] => generateReport), Array ([0] => 1,[1] => 2011-02-08,[2] => 1,[3] => ,[4] => 1,[5] => day)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Proxy.php:150]#9 Piwik_API_Proxy->call(Piwik_PDFReports_API, generateReport, Array ([token_auth] => 2f855385ea79a4a57dc12cf86813d5d9,[module] => API,[action] => index,[idSite] => 1,[period] => day,[date] => 2011-02-08,[method] => PDFReports.generateReport,[idReport] => 1,[outputType] => 1,[filter_limit] => 50)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Request.php:117]#10 Piwik_API_Request->process() called at [/var/www/clients/client7/web10/web/piwik/plugins/API/Controller.php:27]#11 Piwik_API_Controller->index()#12 call_user_func_array(Array ([0] => Piwik_API_Controller Object ([] => API,[] => ,[] => ,[] => 1,[] => ),[1] => index), Array ()) called at [/var/www/clients/client7/web10/web/piwik/core/FrontController.php:125]#13 Piwik_FrontController->dispatch() called at [/var/www/clients/client7/web10/web/piwik/index.php:60]


Warning: fopen(/tmp/jpg_jLtgvQ) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Operation not permitted in /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php on line 7611 

Backtrace -->
#0 Piwik_ErrorHandler(2, fopen(/tmp/jpg_jLtgvQ) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Operation not permitted, /var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php, 7611, Array ([file] => /tmp/jpg_jLtgvQ))#1 fopen(/tmp/jpg_jLtgvQ, rb) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7611]#2 TCPDF->_parsepng(/tmp/jpg_jLtgvQ) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7549]#3 TCPDF->_toPNG(Resource id #201) called at [/var/www/clients/client7/web10/web/piwik/libs/tcpdf/tcpdf.php:7322]#4 TCPDF->Image(/var/www/clients/client7/web10/web/piwik/plugins/UserSettings/images/browsers/FF.gif, 12, 39,53875, 4) called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:240]#5 Piwik_PDFReports_PDFRenderer->paintReportTable() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/PDFRenderer.php:172]#6 Piwik_PDFReports_PDFRenderer->paintReport() called at [/var/www/clients/client7/web10/web/piwik/plugins/PDFReports/API.php:284]#7 Piwik_PDFReports_API->generateReport(1, 2011-02-08, 1, , 1, day)#8 call_user_func_array(Array ([0] => Piwik_PDFReports_API Object ([] => Array ()),[1] => generateReport), Array ([0] => 1,[1] => 2011-02-08,[2] => 1,[3] => ,[4] => 1,[5] => day)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Proxy.php:150]#9 Piwik_API_Proxy->call(Piwik_PDFReports_API, generateReport, Array ([token_auth] => 2f855385ea79a4a57dc12cf86813d5d9,[module] => API,[action] => index,[idSite] => 1,[period] => day,[date] => 2011-02-08,[method] => PDFReports.generateReport,[idReport] => 1,[outputType] => 1,[filter_limit] => 50)) called at [/var/www/clients/client7/web10/web/piwik/core/API/Request.php:117]#10 Piwik_API_Request->process() called at [/var/www/clients/client7/web10/web/piwik/plugins/API/Controller.php:27]#11 Piwik_API_Controller->index()#12 call_user_func_array(Array ([0] => Piwik_API_Controller Object ([] => API,[] => ,[] => ,[] => 1,[] => ),[1] => index), Array ()) called at [/var/www/clients/client7/web10/web/piwik/core/FrontController.php:125]#13 Piwik_FrontController->dispatch() called at [/var/www/clients/client7/web10/web/piwik/index.php:60]

How can I resolve this problem and print a PDF report??

thanks for your support

I have the same problem, but i have no idea what to do.

I hope somebody could help me.

thx

Hej,

I had a smiliar problem.

For me the solution of “ma67” posted in german forums worked: 301 Moved Permanently

Create in


piwik/libs/tcpdf/[b]cache[/b]

and


piwik/libs/tcpdf/[b]images[/b]

directories.

Maybe give full acces to those directories (chmod 777).

Good luck!

Niko

Thanks, that worked for me!

[quote=niko]
Hej,

I had a smiliar problem.

For me the solution of “ma67” posted in german forums worked: 301 Moved Permanently

Create in


piwik/libs/tcpdf/[b]cache[/b]

and


piwik/libs/tcpdf/[b]images[/b]

directories.

Maybe give full acces to those directories (chmod 777).

Good luck!

Niko[/quote]

Yes, your right but 755 with owner/group www-data.www-data - on Debian/Ubuntu - is the better solution if you have root access.B)
This is a bug while these directories are missing.

Where can I post issues to the piwik’s issue tracker?
Found: PDFReports: TCPDF temporary subject to open_basedir restriction · Issue #1656 · matomo-org/matomo · GitHub refers to our problem.

Regards

Thorsten

Thanks for the solution! Now work like a charm!

Steps:
[ul]
[li] created images/and cache/ in lib/tcpdf
[/li][li] chmod to 755 && chown to www-data:www-data
[/li][/ul]

Thanks again!

i have tried your method as well, it is working well when i am generating pdf reports. of cource i have my own tool and methods when create pdf files.
so i rarely have any problme in making pdf c# . hope it is helpful for you.

This post was flagged by the community and is temporarily hidden.