Page 1 of 3

Server generated SQL

Posted: Sat 02 May 2020 9:25 am
by richard_newberry
I am trying to get this to work.

http://desford-weather.co.uk/images/graphHum.php

I have made sure cumulus.realtime exist and it does.

Not quite sure why this isnt working. Anyone have any ideas?

Thank you

P.S going to throw it out the window soon.

Re: Server generated SQL

Posted: Sat 02 May 2020 10:16 am
by MagnusGallstad
Is there any reason to place php file in folder " images " ?

Re: Server generated SQL

Posted: Sat 02 May 2020 10:44 am
by water01
I assume that cumulus.realtime is the MySQL table that contains your realtime data?

What that is saying is that it cannot access it, despite you saying the table exists. Now if you are using the standard CumulusMX SQL have you set up that name (realtime) in the name box in the settings as the standard name if you used ImportCumulusFile.php is Realtime with a capital R.

Plus the actual code in graphHum.php

Code: Select all

$query = "SELECT unix_timestamp(LogDateTime) AS time, $cols[attachment=0]jgraph problem.png[/attachment][attachment=0]jgraph problem.png[/attachment]
        FROM Realtime
        WHERE LogDateTime >= now() - INTERVAL " .$GRAPH['hours']. " HOUR
        ORDER BY time";
needs to reflect the naming of the table.

So I suspect that you have either a fault in your graph.settings file or the include file that sets the parameters to access your MySQL database.

On looking at the gauges on your site none of the images appear so that is consistent with incorrect settings.

Edit
Just checked a couple of other things. If it is working correctly you should be able to see the picture generated by using this URL http://desford-weather.co.uk/images/hum.png but in your case you appear to also have a jpgraph problem.

Re: Server generated SQL

Posted: Sun 03 May 2020 12:01 am
by richard_newberry
I don't know how to sort it out but would like to know what is causing it though.

graphsettings.php im /var/www/images see below.



$GRAPH = array();
############################################################################
# CONFIGURATION INFORMATION
############################################################################
$GRAPH['version'] = '1.7';
$GRAPH['width'] = 600;
$GRAPH['height'] = 300;
$GRAPH['jpgraphloc'] = '/var/www/jpgraph/'; // Path to jpgraph, or put it in your PHP path
// NOTE: This is the *server* operating system path to the file, so unless you have added
// the web folder to your PHP path, it will be something like "/home/<userid>/www/jpgraph/"
$GRAPH['cachetime'] = 10; // number of minutes to cache images
$GRAPH['hours'] = 24; // number of hours to graph
$GRAPH['uom'] = array('temp'=>'C', 'rain'=>'mm', 'wind'=>'mph', 'baro'=>'hPa', 'cloudbase'=>'feet');
$GRAPH['rosePoints'] = 16; // 8 or 16
$GRAPH['roseSize'] = 400;
// Localised Compass point array
$GRAPH['compass'] = array('N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW');

in /var/www/jpgraph/jpg-conf.inc.php see below

define('CACHE_DIR','/var/www/jpgraph/csimcache/');
define('TTF_DIR','/var/www/jpgraph/fonts/');
define('MBTTF_DIR','/var/www/jpgraph/fonts/');

//-------------------------------------------------------------------------
// Cache directory specification for use with CSIM graphs that are
// using the cache.
// The directory must be the filesysystem name as seen by PHP
// and the 'http' version must be the same directory but as
// seen by the HTTP server relative to the 'htdocs' ddirectory.
// If a relative path is specified it is taken to be relative from where
// the image script is executed.
// Note: The default setting is to create a subdirectory in the
// directory from where the image script is executed and store all files
// there. As ususal this directory must be writeable by the PHP process.
define('CSIMCACHE_DIR','csimcache/');
define('CSIMCACHE_HTTP_DIR','csimcache/');

all have chmod 775 permissions?

in jpgraph/fonts

I Have arial.ttf and verdana.ttf all chmod 775

Any ideas people??

Re: Server generated SQL

Posted: Sun 03 May 2020 12:03 am
by richard_newberry
I have no cumulus.realtime problem no more just jpgraph problem now.

Tried restoring jpgraph folder from a backup and still the same problem?

Re: Server generated SQL

Posted: Sun 03 May 2020 7:14 am
by laulau
Do you have DejeVuSans.ttf installed in fonts ?
Capture.PNG

Re: Server generated SQL

Posted: Sun 03 May 2020 9:05 am
by water01
I very much doubt that JpGraph is installed at /var/www/.

It should be in your server area where your web site is installed so it is going to be more like

Code: Select all

$GRAPH['jpgraphloc']     = '../jpgraph/'; // Path to jpgraph, or put it in your PHP path

Re: Server generated SQL

Posted: Sun 03 May 2020 10:37 am
by richard_newberry
Its in /var/www where jpgraph is located where jpgraph is located.

Re: Server generated SQL

Posted: Sun 03 May 2020 10:58 am
by water01
But the jpgraphloc is a relative location not a complete location so if it is in a directory within your website the correct location is ../jpgraph.

The only other possibility is that the font doesn't exist within the fonts directory within the jpgraph directory.

Re: Server generated SQL

Posted: Sun 03 May 2020 11:37 am
by richard_newberry
root@debian:/var/www/jpgraph/fonts# ls
arial.ttf DejaVuSans-Bold.ttf DejaVuSans.ttf FF_FONT0.gdf FF_FONT1.gdf FF_FONT2.gdf lcdmono2ultra-webfont.svg LICENSE.TXT
DejaVuSans-BoldOblique.ttf DejaVuSans-Oblique.ttf FF_FONT0-Bold.gdf FF_FONT1-Bold.gdf FF_FONT2-Bold.gdf lcdmono2ultra-webfont.eot lcdmono2ultra-webfont.ttf Verdana.ttf

PHP Notice: date_default_timezone_set(): Timezone ID '+0:00' is invalid in /var/www/images/graphSettings.php on line 45, referer: http://desford-weather.co.uk/images/

if set to Europe/London I get a Error TZ Statement.

Re: Server generated SQL

Posted: Sun 03 May 2020 11:39 am
by richard_newberry
water01 wrote: Sun 03 May 2020 10:58 am But the jpgraphloc is a relative location not a complete location so if it is in a directory within your website the correct location is ../jpgraph.

The only other possibility is that the font doesn't exist within the fonts directory within the jpgraph directory.
Done that no change.

It's something to do with php open_basedir not allowing jpgraph to access the fonts.

in /etc/php/7.3/apache2/php.ini I have ;open_basedir =

Re: Server generated SQL

Posted: Mon 04 May 2020 11:16 am
by richard_newberry
Problem I have got now is as following:-

Error TZ Statement if I don't set timezone to +00:00 then I get the following error message.
PHP Notice: date_default_timezone_set(): Timezone ID '+00:00' is invalid in /var/www/images/graphSettings.php on line 45, referer: http://desford-weather.co.uk/gauges-ss.htm

Also on jpgraph faq website I have created the following file and tested to see if php can find the fonts file or not.

https://jpgraph.net/doc/faq.php#F3-6

I have called this checkfonts.php as you can see http://desford-weather.co.uk/checkfonts.php php finds the font folder and says the following message.
PASS: Successfully read font file "/var/www/jpgraph/fonts/DejaVuSans.ttf". as I am having an error with jpgraph error 25092

So this is down to a problem with jpgraph which I have reported the problem with jpgraph or it's the SQL files im /images folder which Mark have created. (not blaming mark btw).

I am running wordpress due to business website and latest wordpress version requires php7.4. jpgraph 4.3.1 supports php7.4

So as a IT Technician I know a little about php but not much more hardware and software problem solving guy not really a coding type of person.

So any coding specialist people reading this can you give me any ideas how to sort this out please.

I am beginning to have greys hairs now. This is an interesting problem now.

It's only pictures but just makes the gauges complete and look nice.

Thanks for any suggestions.

Re: Server generated SQL

Posted: Mon 04 May 2020 11:51 am
by water01
As a matter of interest if you run phpinfo.php (I have attached it just in case) on your server does it show that gd is available as per the picture?
gd.png
Note I have attached phpinfo as phpinfo.txt (Forum does not allow uploads of php files) just rename it as phpinfo.php upload it and run I presume http://desford-weather.co.uk/phpinfo.php

The reason I ask is the php extension gd is required to run jpgraphs.

Re: Server generated SQL

Posted: Mon 04 May 2020 11:54 am
by richard_newberry
Thanks for replying mate.

http://desford-weather.co.uk/phpinfo.php click on it and you'll see Gd displaying the following:-

gd
GD Support
enabled
GD headers Version
2.2.5
GD library Version
2.3.0
FreeType Support
enabled
FreeType Linkage
with freetype
GIF Read Support
enabled
GIF Create Support
enabled
JPEG Support
enabled
PNG Support
enabled
WBMP Support
enabled
XPM Support
enabled
XBM Support
enabled
WebP Support
enabled
BMP Support
enabled
TGA Read Support
enabled

That's a tick to say it's enabled.

Re: Server generated SQL

Posted: Mon 04 May 2020 12:02 pm
by water01
No problem.

Therefore it is still a path problem as you have tested the permissions, but I must admit it has me puzzled, need to think about it!!