How to setup jpgraphs and wxgraphs

Did you check your jpg-config.inc.php and set the directories. I assume that you did. Sorry if I am repeating things. It could be something to do with the new file because I do not have it jpgraph_ttf.inc.php.

// Directories for cache and font directory.
//
// CACHE_DIR:
// The full absolute name of the directory to be used to store the
// cached image files. This directory will not be used if the USE_CACHE
// define (further down) is false. If you enable the cache please note that
// this directory MUST be readable and writable for the process running PHP.
// Must end with ‘/’
//
// TTF_DIR:
// Directory where TTF fonts can be found. Must end with ‘/’
//
// The default values used if these defines are left commented out are:
//
// UNIX:
// CACHE_DIR /tmp/jpgraph_cache/
// TTF_DIR /virtual/users/e14497-14796/web/graphs/jp/ttf/
// MBTTF_DIR /usr/share/fonts/ja/TrueType/
//
// WINDOWS:
// CACHE_DIR $SERVER_TEMP/jpgraph_cache/
// TTF_DIR $SERVER_SYSTEMROOT/fonts/
// MBTTF_DIR $SERVER_SYSTEMROOT/fonts/
//
//------------------------------------------------------------------------
// DEFINE(“CACHE_DIR”,“/tmp/jpgraph_cache/”);
// DEFINE(“TTF_DIR”,“/virtual/users/e14497-14796/web/graphs/jp/ttf/”);
// DEFINE(“MBTTF_DIR”,“/usr/share/fonts/ja/TrueType/”);

Chuck

i do have this under the main section where it says to change it…

// define(“TTF_DIR”,“/virtual/users/e16108-17165/web/jpgraph-2.3.4/ttf/”);

But I didnt change the windows or unix section. i never had to do that before.

Here is another repeater probably. Under the jpgraph.php. Just trying to cover everything I can think of. :wink:

if (!defined(‘TTF_DIR’)) {
if (strstr( PHP_OS, ‘WIN’) ) {
$sroot = getenv(‘SystemRoot’);
if( empty($sroot) ) {
$t = new ErrMsgText();
$msg = $t->Get(12,$file,$lineno);
die($msg);
}
else {
define(‘TTF_DIR’, $sroot.‘/fonts/’);
}
} else {
define(‘TTF_DIR’,‘/usr/share/fonts/truetype/’);
}

Chuck

Yeah…thats the same. Im starting to wonder If its the fonts I uploaded from the windows folder. But ive uploaded new font files. But for some reason, i think they may be the problem.

I am sort of stuck on this one. I downloaded the newer version 2.3.4 and there are some new files incorporated.

Chuck

Yeah…I was using the v4 one before, and it worked fine. But this one has me stuck.

Well I just took a look at the error from one of your graphs and it says ‘open_basedir restriction in effect’ which if I’m correct says that anything your web server is going to access has to be within the specified root directory for your wweb server (ie. where you put your pages and stuff) so if you have a path with starts outside of that directory it will fail.

In this case you have /usr/share/fonts/truetype/arialbd.ttf which is a full unix path relative to the absolute root directory and wont open, you have to have a fonts directory within your normal web stuff and point to it. So I think you should try something like making a directory called fonts in your normal structure and just specify it as fonts/.

This is nothing to do with JPGrpahs per se, its caused by a PHP5 restriction and the way you are specifying your path. My JPGraphs work fine on PHP5.

Stuart

Thanks. Then it has to do with e-rice making you upload your files to the /web folder directory. i know it has nothing to do with jpgraphs cause it worked fine on my last host. Im still a bit confused on what you suggested to do to fix this. Just make a new folder called fonts and change the path in what file? Thanks.

The jpgraph-config-inc.php file contains the line where you set the path to your own font files. This is documented in the install instructions.

Stuart

Oh…Ok…Now i get it. I’ll give that a try after work today…Thanks

Heres where Im at now on this problem. Ive made a new directory called fonts, and uploaded the 2 font files its asks for to that folder. Still nothing. Then i changed this part in the config file…


// define("TTF_DIR","/virtual/users/e16108-17165/web/jpgraph-2.3.4/ttf/");


But nothing with that either.

I then tried to change this part…Since this is the part that actually shows up in the error…



TTF_DIR   /usr/share/fonts/truetype/

No matter how i change that part, the error still shows the samething, and same path.

Ive now changed everything back to the original settings.

Try these. Don’t forget to remove the “//”

define("TTF_DIR","/web/jpgraph-2.3.4/ttf/");
define("TTF_DIR","/jpgraph-2.3.4/ttf/");

I tried each of those in this area, and none of them worked. i hope thats what you meant for me to try.


// define("CACHE_DIR","/tmp/jpgraph_cache/");
// define("TTF_DIR","/jpgraph-2.3.4/ttf/");
// define("MBTTF_DIR","/usr/share/fonts/ja/TrueType/");




All those lines have // in front of them, that usually means they are commented out so the program ignores them :?

Heres the whole setting options…



// UNIX:
//   CACHE_DIR /tmp/jpgraph_cache/
//   TTF_DIR  /web/jpgraph-2.3.4/ttf/
//   MBTTF_DIR /usr/share/fonts/ja/TrueType/
//
// WINDOWS:
//   CACHE_DIR $SERVER_TEMP/jpgraph_cache/
//   TTF_DIR   $SERVER_SYSTEMROOT/fonts/
//   MBTTF_DIR $SERVER_SYSTEMROOT/fonts/
//
//------------------------------------------------------------------------
// define("CACHE_DIR","/tmp/jpgraph_cache/");
// define("TTF_DIR","/jpgraph-2.3.4/ttf/");
// define("MBTTF_DIR","/usr/share/fonts/ja/TrueType/");



Right, and none of those lines are being read because of the //

I know. But I never had to mess with any of that before. Thats what has me so lost in this.

My guess is that’s because your previous host had the fonts installed in the default directory where the graphs look for them. e-rice doesn’t have the fonts installed so that’s why you need to make some changes.

i actually made some progress…lol

http://www.snoqualmieweather.com/wxgraphs/solar_24hr.php

wow…finally got them back working…time for a beer…lol

http://www.snoqualmieweather.com/wxgraphs/rain_7days.php

Thanks Niko.