0

http://signitysolutions.co.in/dev/php/loancalculator.php

I have created a graph using highcharts, I need to export to image to server so I can create a PDF of graph and the data available on the page, I am setting up export server, using this How to save an image of the chart on the server with highcharts? as reference

When I click on Save Graph Image button just below the graph, I get a Javascript error which I do not understand:

send                          jquery-1.7.1.js:8102
jQuery.extend.ajax            jquery-1.7.1.js:7580
(anonymous function)          loancalculator.php:749
jQuery.event.dispatch         jquery-1.7.1.js:3256
elemData.handle.eventHandle

Can anyone guide me here?

Community
  • 1
  • 1
Hemant.Gupta
  • 147
  • 1
  • 13
  • send jquery-1.7.1.js:8102 jQuery.extend.ajax jquery-1.7.1.js:7580 (anonymous function) loancalculator.php:749 jQuery.event.dispatch jquery-1.7.1.js:3256 elemData.handle.eventHandle this is error as seen in chrome console – Hemant.Gupta Jul 05 '13 at 08:05
  • What is the text of the internal server error? – LSerni Jul 05 '13 at 08:22
  • @lserni the above comment is all that I get, you can check in chrome console after clicking the button you see the internal server error – Hemant.Gupta Jul 05 '13 at 08:51
  • POST http://signitysolutions.co.in/dev/php/export/ 500 (Internal Server Error) this is what i see in chrome – Hemant.Gupta Jul 05 '13 at 09:09
  • @lserni I think now the issues is more clear to me, since I am new to this, and this maybe a stupid question but batik-rasterizer.jar do it have to get it installed on the server? As now temp.svg is being generated but $output is always blank. can you give me link from where I should download this. – Hemant.Gupta Jul 05 '13 at 10:31
  • Check out Nobita's answer here: http://stackoverflow.com/questions/8802528/how-to-save-an-image-of-the-chart-on-the-server-with-highcharts . Your problem is, in all likelihood, connected to the HighCharts installation prerequisites, so you have to go over the installation procedure again: are all needed packages installed? Do they work correctly? Check the docs at http://docs.highcharts.com/#export-server-setup – LSerni Jul 05 '13 at 11:22

1 Answers1

0

You have an error while sending to the server. Check out the Network panel to see what was the request, and what got returned by the server that caused the jQuery error.

Image creation is done on the server, and jQuery sends to it the information needed to assemble the image. Apparently, jQuery sent the request, but the server did not comply. When this happens, the error message you need is the one returned by the server.

For example, a 404 error would indicate that you did not install the necessary HighCharts server-side components.

A PHP error such as function not existing might instead indicate that you not have some necessary software installed (typically the GD2 module, libjpeg, and/or ImageMagick).

Finally the 500 Internal Server Error indicates that there is another error behind that one, and it can be found in the Web server's error log. It could be for example a .htaccess problem in an ancillary plugin directory.

The Web server error log on shared hosting can usually be checked/cleared/downloaded from your hosting provider's control panel, or you can check it directly from the site configuration file path setups if you have SSH access (check ErrorLog entries); if all else fails, it can be usually found in /var/log/apache... on Unix/Linux systems.

You can also check out the Web request that caused the error, and inspect it visually to assess whether, for example, you do not have such a path (that you know of). This would then indicate that there's an installation problem.

Finally, you can check that path (/dev/php/export), and modify the source of its index file to track down an error. This is sort of a last ditch effort if no other debugging is possible:

<?php
     // This is the index.php file that receives the POST
     print "<pre>"; print_r($_POST); die(); // DEBUG-ONE
     // The above line crashes the request, but should avoid the 500 Error
     // and show the POST information.

     ...some code from the original file...

     die("<pre>".date("Y-m-d H:i:s") . " No 500 Error so far");
     // After commenting the DEBUG-ONE, processing goes on and
     // should arrive here. If it doesn't, obviously the error
     // is between there and here.
     // etc.
LSerni
  • 55,617
  • 10
  • 65
  • 107
  • Would it be possible for you to do a small chat with me? I already checked, there is not error log generated for this error. – Hemant.Gupta Jul 05 '13 at 09:21
  • A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again. this what I get on calling the index.php directly. you have excuse me but I am novice when it comes to PHP as I am mainly a ASP.net coder – Hemant.Gupta Jul 05 '13 at 09:32
  • define ('BATIK_PATH', 'batik-rasterizer.jar'); How can I confirm this jar is available or not? maybe this is the issue. – Hemant.Gupta Jul 05 '13 at 09:34
  • The internal server issue is resolved, but now i am getting "Error while converting SVG." – Hemant.Gupta Jul 05 '13 at 09:44
  • [05-Jul-2013 03:59:44] PHP Warning: file_put_contents(/dev/php/temp/110eab2529bfb173bc033d6c71585022.svg) [function.file-put-contents]: failed to open stream: No such file or directory in /home7/boutiqx2/public_html/dev/php/export/index.php on line 63 – Hemant.Gupta Jul 05 '13 at 10:03
  • Okay, you have a directory that does not exist, so the file isn't saved. Apparently it is a path problem: that file_put_contents should reference a variable that is empty, and that should instead point to your webroot /home7/boutiqx2/public_html . Check your default temporary path in php.ini, too. – LSerni Jul 05 '13 at 11:28
  • I think now the only issue is batik is not installed on the server, my core problem seem to have corrected when i used full http address for post instead of referential address. Rest all was permissions and security issues. Thanks a bunch for all your support. – Hemant.Gupta Jul 05 '13 at 12:05
  • You're welcome. For Batik, check out that URL I quoted in the other comment (the one on the docs), there are details on what to download and where to install. – LSerni Jul 05 '13 at 16:59
  • Just to update you I have dropped the conversion part and have improvised and use the .svg directly in TCPDF to export to PDF, making the process bit less complicated for me. – Hemant.Gupta Jul 08 '13 at 10:25