ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-09-2021 02:13
Hi Peter,

I just updated from Ubuntu 16.04 to 18.04  and my charts are no longer displaying. I've spent 2 days trying to trace the problem without success.

I create a chart with: $chart1 = $c->makeSession("chart", PNG);
and later display it with: <img class="img-responsive" src="/charts/getchart.php?<? echo $chart1 ?>" border="0"  usemap="#map1" onMouseOver="overChart(1)" onMouseOut="overChart(0)">

The image is no longer displaying and inspecting the code shows
<img class="img-responsive" src="/charts/getchart.php?img=chart&id=pb410jog3s495akl6rasj5gupj6138fcafe19b5&" border="0" usemap="#map1" onmouseover="overChart(1)" onmouseout="overChart(0)">

I'm grateful for your help
Mike Gibbons

  Re: getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-09-2021 09:04
More information:

My development server runs Ubuntu 20.04 under mod-php while my new server runs CGI/FastCGI.

The charts work perfectly on the development machine. Could the problem relate to CGI/FastCGI?

  Re: getchart.php not working in Ubuntu 20.04
Posted by Peter Kwan on Sep-09-2021 14:44
Hi Mike,

CGI/FastCGI is unlikely to be the issue. Nowadays most servers use FastCGI, so most of the ChartDirector installations are running under FastCGI.

To trouble-shoot the problem, you may want to ensure error reporting is enabled in your PHP server so that you can see any error message. This is by setting display_errors = On and error_reporting = E_ALL in your "php.ini", then restart your PHP. Some PHP installations nowadays runs as a separate Fast Process Manager service, in which case you would need to restart the Fast Process Manager service to restart PHP (restart Apache may not be enough). You can use phpinfo to confirm if display_errors and error_reporting is set up as intended.

Please try some sample code that comes with ChartDirector, such as "simplebar.php" and the "clickbar.php" (the latter also uses "getchart.php"). Bring up the Developer Tools in Google Chrome (press F12). At the top, select the "Network". Now when you press the refresh button, you should see Chrome loading each of the link in your page, including the "getchart.php?....." link. To avoid too much information, you may use a simple test page, such as the clickbar.php sample code.

Now click on the "getchart.php?...." link, and you can select to display the headers, preview and response. If there is any error message, they can be found there. Please let me know what is the result.

My guess is that it has something to do with session variables. May be session variables is not enabled in your PHP.

For your information, in the latest version of ChartDirector (7.0), we have change the sample code style to use inline SVG images instead of session variables. In this case, getchart.php is not necessary. (All modern browsers support inline images.)

Regards
Peter Kwan

  Re: getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-09-2021 20:35
Thank you for the detailed response.

The old clickbar.php on which I'd modeled my code (now very old) gave the same response.

Using the developer tools as you described did show the getchart loading but previewing the image was blank.

the session save directory showed the img chart id  with  zero length

Syslog showed php: PHP Warning:  Unknown: write failed: Disk quota exceeded (122) in Unknown on line 0
Sep  9 11:36:40 proactech php: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/breakoutwatch/tmp) in Unknown on line 0

There was plenty of memory and the session save path was correct.

I also tried using the version 7 clickbar.php which worked correctly. So i changed the code as follows
//$chart1 = $c->makeSession("chart", PNG);
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);

if ($chart1) { ?>
            <!--<img class="img-responsive" src="/charts/getchart.php?<? echo $chart1 ?>" border="0"  usemap="#map1" onMouseOver="overChart(1)" onMouseOut="overChart(0)">-->
             <?php echo $viewer->renderHTML(); ?

Now I get a 500 response code with no indication of why in syslog

Developer tools now showed the SVG data was there it its not being rendered

I use the Brave browser and got the error chorome-error//chromewebdata

Any further help you can offer would be appreciated

You can see the problem here: https://www.breakoutwatch.com/charts/BoWChart.php?ChartSize=H&symbol=AMZN

  Re: getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-10-2021 05:09
Peter,
I'm getting desperate for help here.

The pre php 7 clickbar.php gives a missing image Icon and in the log:

PHP Warning:  Unknown: write failed: Disk quota exceeded (122) in Unknown on line 0
PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/breakoutwatch/tmp) in Unknown on line 0

The session.save_path is correct and there is adequate space

when I try the v7 method:

$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, PNG);
$toolTip = "title='Date: {xLabel}nOpen: {open}nHigh: {high}nLow: {low}nClose: {close}'";
$viewer->setImageMap($c->getHTMLImageMap("#", " ", "$showInfo$hideInfo$toolTip"));

<?php echo $viewer->renderHTML(); ?>
I get  500 eror and tools give me the attached image showing that the PNG 'image' is there but not being displayed.

I need help to get either of these methods working.

On my development server using php 7.0 and mod_php the getchart.php version works.

  Re: getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-10-2021 05:10
PS. I'll get my license update when I get this working

  Re: getchart.php not working in Ubuntu 20.04
Posted by Peter Kwan on Sep-10-2021 14:56
Hi Mike,

I have tried your web page. There is no error in the PHP code. It is just that the image is zero bytes, and the browser cannot understand a zero byte image, so it outputs a broken image symbol.

The error log shows "Disk quota exceeded". This error message comes from the operating system. It means the user or group that writes to the disk has exceeded some limits (the total storage used or the number of files created).

If you are using a shared server, the quota may be configured by the hosting company. If you believe you have not exceeded the quota of the hosting plan, you may contact the hosting company and report this problem.

If you have shell access, first determine who is writing to the disk. The web server/PHP may be using your account or some other account to write to the disk. You may try to use the "quota" command to determine if the user or group quota has been exceeded.

https://linux.die.net/man/1/quota

You may also use "df" and "df -i" to check for disk space and inode space.

If you modified the code to use the ChartDirector 7 method, and it displays the 500 error,  it just means there is some error in the modified PHP code. If you have enabled "display_errors" as mentioned in my last message, it should display the PHP error message instead of error 500.

By reading your code, I can see a potential error. You modified code still include the line "<? echo $chart1 ?>", but the $chart1 may be undefined. You used "<!-- -->" to try to comment out the code, but it is not a comment in PHP. (It is a HTML comment which is interpreted by the browser, but your code runs on the server side.) There may be other errors and it is easier to debug the code with "display_erros" turned on. If you cannot turn on "display_errors", you may have to look at the php log file for the error message.

Regards
Peter Kwan

  Re: getchart.php not working in Ubuntu 20.04
Posted by Peter Kwan on Sep-10-2021 15:00
Hi Mike,

For the Disk quota problem, one method you may try is to find if there are many unnecessary files owned by the same user or group. Examples include temporary files (is there any tmp directory), session files, email files (some Linux machine save email messages as files), etc. Try to delete unnecessary files to see if it helps.

Regards
Peter Kwan

  Re: getchart.php not working in Ubuntu 20.04
Posted by Mike Gibbons on Sep-10-2021 18:05
Hi peter,

Thanks for bearing with me.

In fact, the answer was staring me in the face but I didn't believe it.

Quota was exceeded! This was a breand new server setup after my old server was taken down by the hosting company because it was hacked and being used for brute force password attacks on other servers.

I installed virtualmin and created virtual servers but it gave a 1gb limit to breakoutwatch.
I upped it to 10gb and now the charts are working.

I'm sorry to have wasted your time, your support has always been excellent.
Than you,
mike gibbons