PDA

View Full Version : Help installing jpgraph for PHP



jgillett
05-13-2010, 01:40 PM
The Subject says it all.

Caveats - I'm not a server guy, even though my profession since 1965 has been computers. Too bad my ColdFusion won't help...

Anyway, gently, please. :)

Thanks.

wildjokerdesign
05-13-2010, 02:49 PM
Hey John,
What version of WestHost do you have 3.0 or 4.0? I would assume by you join date here in the forum that it would be 3.0.

So here is your answer.... This is a simply a php library so in reality you can upload/install it any place you want. If you are on WH 3.0 then if you upload it to the following location then it may make thing easier.
/usr/local/php/lib/php
If you have followed the instructions here: http://hem.bredband.net/aditus/chunkhtml/ch02.html#id2507336 then you can simply use require_once('jpgraph/jpgraph.php') in any php script you want to use it in. :)

If you want to give more details of how you intend to use this then I may be able to give you more details if you are having problems.

BTW: To find out your include path simply upload a php file with the following code in it.

<?php
phpinfo();
?>
Search the results of that file in a browser for include_path found under Configuration PHP Core.

wildjokerdesign
05-13-2010, 02:53 PM
Ahh... I just read this in the Install page.

[Optional] Verify that the paths defined in jpg-config.inc.php corresponds to the server setup. The path to your TTF fonts must be correct. If you get an error saying that some TTF fonts cannot be found or read then the path needs to be adjusted in this configuration file.
I bet if you are having issues that might be your problem. There are no TTF fonts installed on your system so unless this library comes with them then you may have to deal with that. I did not download the package to check but if that is your issue let me know and I can download and explore more.

wildjokerdesign
05-13-2010, 03:09 PM
I really should read all the documentation before I post. :)

If you are looking for php.ini file it is located at /etc/php.ini. That is on WH 3.0 if you are dealing with WH 4.0 then it is more complicated. http://forums.westhost.com/showthread.php?t=14325

It does seem like you have to install the fonts yourself. They suggest getting them from http://corefonts.sourceforge.net/ but we don't have rpm-build. I have no idea if this is "legal", but the times I've needed true type fonts, I have simply uploaded them from my local computer. I bet you know where they are located since you are a computer guy, but just in case anyone else is reading this I located by going to Control panel clicking on Fonts. See those files with a TT icon? Those are what you want. I doubt you need them all. :) They also suggest a couple other sources for fonts. http://hem.bredband.net/aditus/chunkhtml/ch03s04.html They mention some default paths for fonts on UNIX but we do not have write permissions on those paths... in fact you won't find them on your account and can't create them. You could upload them any place you want really. Maybe in the same directory as the jpgraph library under a font directory. Just make sure you change that TTF_DIR define in jpg-config.inc.php to the location where you uploaded them. ;)

jgillett
05-13-2010, 03:41 PM
What version of WestHost do you have 3.0 or 4.0? I would assume by you join date here in the forum that it would be 3.0.
3.0 is correct.

So here is your answer.... This is a simply a php library so in reality you can upload/install it any place you want. If you are on WH 3.0 then if you upload it to the following location then it may make thing easier.
/usr/local/php/lib/php
Will do as soon as I finish this.

If you have followed the instructions here: http://hem.bredband.net/aditus/chunkhtml/ch02.html#id2507336 then you can simply use require_once('jpgraph/jpgraph.php') in any php script you want to use it in. :)
Jeez - looked all over the site for instructions. The readme in the D/L says manual included (not!).

If you want to give more details of how you intend to use this then I may be able to give you more details if you are having problems.
Not enough finished yet to know if I'm having problems!

However, if you'll see http://jcweather.us/NSLog.php, click the Add-Ons tab, and scroll to the bottom. Those graphs are what I'm after.

BTW: To find out your include path simply upload a php file with the following code in it.

<?php
phpinfo();
?>
Already done (http://tiggrsuccess.com/info.php).

Also appears that the required GD is enabled.

Thanks!

wildjokerdesign
05-13-2010, 03:52 PM
Ahh... OK.. I went ahead and downloaded the strikes.php files. Looks like the default settings in those files are expecting your jgraph libraries to be uploaded to /jpgraph-2.3.4/src/ in the directory where you have the strikes.php files located and then the true type fonts are in /lightning/ also within the directory where strikes.php is located. They actually supply the .ttf file used in the zip file. Both of these can be changed if you want to.

$jploc = $WEBROOT . "/jpgraph-2.3.4/src/"; // Where your jpgraph is installed

DEFINE ("TTF_DIR", $WEBROOT . "/lightning/" ); // Where truetype font file is located (ariali.ttf)

They actually mention an NSGraph.txt file also in the config of the file but not sure where you get that. :) Maybe you already have that. They expect that to be in /lightning/ also. That should be all you need to deal with I think.

wildjokerdesign
05-13-2010, 04:00 PM
Also appears that the required GD is enabled.
Yep it is! Actually if a host does not have GD enabled then they are really in the dark ages. :) I think just about every CMS, forum or blog program out there uses it now.

wildjokerdesign
05-13-2010, 04:04 PM
BTW: You might want to change the name or remove the info.php file on your account now that you have the info and since you posted it publicly now. Best not to let prying eyes see this. Really once they figure out you are on WestHost it should be pretty easy to determine this info but always best to be safe and it does have details of your set up.

jgillett
05-13-2010, 04:21 PM
Ahh... OK.. I went ahead and downloaded the strikes.php files. Looks like the default settings in those files are expecting your jgraph libraries to be uploaded to /jpgraph-2.3.4/src/ in the directory where you have the strikes.php files located and then the true type fonts are in /lightning/ also within the directory where strikes.php is located. They actually supply the .ttf file used in the zip file. Both of these can be changed if you want to.

$jploc = $WEBROOT . "/jpgraph-2.3.4/src/"; // Where your jpgraph is installed

DEFINE ("TTF_DIR", $WEBROOT . "/lightning/" ); // Where truetype font file is located (ariali.ttf)
Uploading now (24MB at a crawl!) to /usr/local/php-5.2.13/lib/php. Really hate Cox.

Anyway, you probably noticed the folder as jpgraph-3.0.7. As they suggested, I changed that to just jpgraph and will adjust the config.

They actually mention an NSGraph.txt file also in the config of the file but not sure where you get that. :) Maybe you already have that.
I do.

Thanks again.

jgillett
05-13-2010, 04:22 PM
BTW: You might want to change the name or remove the info.php file on your account now that you have the info and since you posted it publicly now.
Already gone.

jgillett
05-13-2010, 04:55 PM
OK - progress... :)

http://tiggrweather.net/NSTestStrict.php

Still have to work on some graphics that have been uploaded to other locations, but the graph is working. That's one-in-a-row!

Many thanks.

wildjokerdesign
05-14-2010, 06:34 AM
Pretty cool stuff! It is like having your own weather station. :)

Although it is obvious to me and you evidently figured it out also, I thought I would mention for others reading that the path for $jploc in your instance would need to be the full path "/usr/local/php-5.2.13/lib/php/jpgraph/" or since you installed it within the php_include path you should also be able to use just "jpgraph". Paths can be tricky sometimes for folks.

jgillett
05-14-2010, 12:06 PM
Pretty cool stuff! It is like having your own weather station. :)
Actually - I do have my own station! http://tiggrweather.net/

The (almost) final page for this is at http://tiggrweather.net/lightning.php. Having a small problem with 2 items in the right column. No biggie.

Although it is obvious to me and you evidently figured it out also, I thought I would mention for others reading that the path for $jploc in your instance would need to be the full path "/usr/local/php-5.2.13/lib/php/jpgraph/" or since you installed it within the php_include path you should also be able to use just "jpgraph". Paths can be tricky sometimes for folks.
'Tricky' is an understatement! In this case I had to use "/usr/local/php-5.2.13/lib/php/jpgraph/src/".