Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2003, 12:49 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default jpGraph

I have sucessfully install php version 4.3.2 and apache 1.3 and have run phpinfo() to check that GD library is supported in my installation with GD Version : bundled (2.0.12 compatible).
    I have also downloaded Jpgraph 1.13 and made the following changes in jpgraph.php:
DEFINE ("USE_CACHE",true); DEFINE("READ_CACHE", true) but when i try to run a pie chart sample the following error occurs.

Warning: main(../jpgraph.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\project\samplepie.php on line 3

Warning: main(): Failed opening '../jpgraph.php' for inclusion (include_path='.;c:\php4\pear') in c:\inetpub\wwwroot\project\samplepie.php on line 3

Warning: main(../jpgraph_pie.php): failed to open stream: No such file or directory in c:\inetpub\wwwroot\project\samplepie.php on line 4

Warning: main(): Failed opening '../jpgraph_pie.php' for inclusion (include_path='.;c:\php4\pear') in c:\inetpub\wwwroot\project\samplepie.php on line 4

Fatal error: Cannot instantiate non-existent class: piegraph in c:\inetpub\wwwroot\project\samplepie.php on line 8

        How can i make sure PHP/Apache have write privileges to cache directory if i plan on using the cache feature.
        Is there any configuration or changes that i have to do order to use jpgraph. Please help!



 
Old October 27th, 2003, 02:22 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

As far as I can see the error messages that you are presenting don't have anything to do with write permissions. These relate to the path for included files. The program is asking for these files which are required for execution but cannot find them. the last error 'Failed to instantiate non-existent class.. blah blah' probably relates to the include path failure, one of those files probably includes the class.

Have a further look at the jpgraph documentation and be sure that you have set any absolute or relative paths accordingly. Having never downloaded or looked at the source code for that program I would be unable to tell you where to find it.

A permissions error would say something to this effect; access denied, unable to create file, or write failed, or something along those lines.

As far as setting write permissions, what OS are you using.. Windows it appears, but which version?

: )
Rich

:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::
 
Old October 27th, 2003, 10:54 PM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now that i've made a few changes, i got a different problem.Please advice if i've done anything wrong or left out anything.
1. downloaded and unzipped JPGraph to C:\Program Files\JpGraph
2. Open jpgraph.php and make the following changes:
i. DEFINE("CACHE_DIR", "C:/Document and Settings/hosefo/Local Settings/Temporary Internet Files/");
ii.DEFINE ("TTF_DIR", "C:/Windows/Fonts/);
iii DEFINE ('USE_TRUECOLOR', true);
iv. DEFINE ("USE_LIBRARY_GD2", true);
v. DEFINE ("USE_CACHE", true);
3. Open php.ini and make the following changes:
i. include_path(".;C:\Program Files\JPGraph\jpgrap_1.13\scr")

However i get error when i try to open the php file.
JPGraph Error : No path specified for CACHE_DIR. Please specify a path for that DEFINE IN jpgraph.php

I have already specify a path CACHE_DIR as above but why did i still get that error?
I'm using PHP4.3.2, Apache 1.3, JpGraph 1.13 under windows xp.


 
Old October 29th, 2003, 07:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Looks good to me. The error you're getting is ONLY displayed when CACHE_DIR is not defined, you're on windows, and $_ENV['temp'] doesn't exist. Double check that your cache dir is valid and you don't have any typos in that line. For example, "Document and Settings" should really be "Documents and Settings" (notice Documents is plural). Still, the error you get is because the path isn't defined, not because the directory is invalid.

If you're still having trouble, feel free to paste the relevant lines from your jpgraph.php here and we'll hunt for problems and typos.


I just unzipped jpgraph, added the jpgraph\src dir to my PHP include_path, defined CACHE_DIR in jpgraph.php, and created this simple test script:

<?php

require_once('jpgraph.php');
$graph = new Graph(300, 200,"auto");

?>

I didn't actually generate a graph, but since the script didn't die with any errors, I assume that everything is working fine to begin with.


Take care,

Nik
http://www.bigaction.org/
 
Old October 30th, 2003, 01:20 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! i can now use jpgraph. Actually, i forgot to uncomment the line to define cache.

By the way, do you know any sites that teach how to use jpgraph with mysql? Because the documentation that come with jpgraph doesn't give tutorial on that.

 
Old October 30th, 2003, 01:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What do you mean use jpgraph with MySQL? Typically, if you store data in a database, then you'll need to extract it and manipulate that data into the structure that jpgraph expects. That's integration, and it accounts for a significant chunk of application development, especially when your application uses 3rd party libraries.


Take care,

Nik
http://www.bigaction.org/





Similar Threads
Thread Thread Starter Forum Replies Last Post
hyperlink+jpgraph tessy Beginning PHP 0 May 8th, 2008 01:35 AM
jpgraph+headers tessy Beginning PHP 0 May 7th, 2008 12:03 AM
Jpgraph Problem sandiphw Beginning PHP 0 September 26th, 2007 07:08 AM
jpgraph setup problem wokoci PHP How-To 8 July 24th, 2003 05:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.