GraPHPiteOpen Source PHP OO Graph Rendering Utility
Frequently Asked Questions
Here is a list of commonly asked questions.

Q0: Where do I obtain GraPHPite?

Q1: What does GraPHPite mean?

Q2: What does OO mean?

Q3: How does GraPHPite work?

Q4: How do I use GraPHPite?

Q5: I have a graph page that includes graphpite.inc, but by it does not show, what's can be wrong?

Q6: When using GraPHPite I get an error: "Fatal error: Call to undefined function: imagecreate() in ..."?

Q7: How do I install GD support in PHP on Windows?

Q8: How do I build PHP from source to use with GraPHPite?


The answers to life, the universe and everything

Q0: Where do I obtain GraPHPite?
GraPHPite can be downloaded from SourceForge at this page: GraPHPite releases

Go to top

Q1: What does GraPHPite mean?
GraPHPite is pronounced "graphite", as in the layered hexagonal structure of carbon. It is an acronym of Graph and PHP and 'ite to make it pronouncable.

Go to top

Q2: What does OO mean?
OO stands for "object oriented" and it is a programming method that (in very short terms) utilizes that instead of thinking of functions or procedures to do our work, we model our system by creating classes/objects, where the behaviour and state are contained within the object. The program "execution" is then accomplished by having objects interact with each other - but still being separate entities. Some of the keywords for OO is: polymorphism, inheritance and encapsulation.

Although PHP's object model (in PHP4 at least) is not the best around - it still provides a powerfull mechanism to create a modularized system, which is what GraPHPite is based on.

Go to top

Q3: How does GraPHPite work?
GraPHPite uses the GD functionality that PHP supplies (almost by default). Together with PHP's object oriented model the graphs are created in a sort of modular way - by using building blocks.

GraPHPite has been (or at least tried to be) developed in a way that allows for easy creation of graphs without the need to manually calculate the coordinates, etc.

Also by using the OO model, GraPHPite is very easily extended, simply by creating new classes which are "supported" by the GraPHPite class tree - that is by extending the base class GraPHParent

Go to top

Q4: How do I use GraPHPite?
I would suggest you read all of the documentation from start to end. The documentation is found in the installation package or in the menu to the left under "Documentation" :o).

No, I would suggest you look at the GraPHPite tutorial found here maybe supplied with the PHP source code from the samples found here.

Support is also supplied via SourceForge tracker items found on the project page

Go to top

Q5: I have a graph page that includes graphpite.inc, but by it does not show, what's can be wrong?
You can open the graph page directly in the browser to get possible error outputted to the browser. Fx
Fatal error: Call to a member function on a non-object in graphpite/skeleton/graphp.inc
on line xyz
This could be caused by a number of things. First of all you could have added an object to a element which does not support it (GraPHPite does as of yes not check for this!). This could for example be something like:
$Graph =& new GraPHP(400, 300);
$Graph->add(new PlotArea(), "PlotArea");
$PlotArea->add(new RandomDataSet(10, 0, 100)); // error!
Another previously seen cause of this can be that the GRAPHPITE_PATH is not set correctly on the file _config.inc. This will be done automatically if using the installer, but when installing from the ZIP package this file has to be edited manually. Change the line:
define("GRAPHPITE_PATH", "c:/data/graphpite/src/");
To point to whatever your location might be, remembering the last /

Go to top

Q6: When using GraPHPite I get an error: "Fatal error: Call to undefined function: imagecreate() in ..."?
This is most likely due to the fact that your PHP does not have GD support, see the following FAQ entries for a solution to this.

Q7: How do I install GD support in PHP on Windows?
Q8: How do I build PHP from source to use with GraPHPite?'

Go to top

Q7: How do I install GD support in PHP on Windows?
Assuming you have installed PHP (otherwise see the instructions in the ZIP file).
From the PHP installation folder (i.e. C:\php) copy the file 'extensions\php_gd2.dll' (for GD2) or extensions\php_gd.dll (for GD1) into your systems folder %SYSTEMROOT%\SYSTEM32 (i.e. c:\windows\system32 or c:\winnt\system32). Then open your php.ini (probably located in %SYSTEMROOT%) and find the line that reads (approx half way down):
;extension=php_gd2.dll
For GD2 and for GD1:
;extension=php_gd.dll
In both cases simply remove the ; in from of the line. Also you might change the include_path to include the GraPHPite src folder for easy inclusion (this is however not necessary). Save and restart your web server.

Go to top

Q8: How do I build PHP from source to use with GraPHPite?
One way to install is using the following (installing with Apache as Shared Module version, i.e. Apache configured with --enable-module=so)
./configure \
    --with-gd \
    --with-jpeg-dir=[jpeg_dir] \
    --with-png-dir=[png_dir] \
    --with-tiff-dir=[tiff_dir] \
    --with-freetype-dir=[freetype_dir] \
    --with-zlib-dir=[zlib_dir] \
    --with-apxs
make 
make install   
Where [jpeg_dir] is the location of the file libjpeg.(a|so), [png_dir] is the location of the file libpng.(a|so), etc.

Go to top

Qx: So what was the answer to life, the universe and everything?
You should not need to ask :o)

Go to top


GraPHPite - Open Source PHP OO Graph Rendering Utility

SourceForge.net Logo