Contents
Login Register Wishes Forum About
Getting Started » Installation
Help topics
Latest updates
2054d  replaceImageMapTitle
2054d  replaceImageMapValues
2054d  createFunctionSerie
2054d  setAbsicssaPosition
2054d  negateValues
Toolbox
  Download as PDF
  Print this page
  Share this page
  Create an account
  Feed the updates!
Google AdSense
Installation - How to install pChart on your web frontend

Most of the time it will be really easy to install pChart on your web server, sometimes it will be impossible.. This documentation explains how to make it works with PHP 4+ and an apache daemon (benchmarks are showing that pChart runs faster with PHP5). To install pChart, extract the contents of the latest pChart archive you‘ve downloaded on your web server folder.

You‘ll find in the class folders the core of the pChart library composed of :

pData.class.php
pDraw.class.php
pImage.class.php

Those files will be called from your PHP scripts so they must be located under the root of your web site.

Font Files

All the ttf files must be accessible from your web scripts, you may need to update the path of the default font using the setFontProperties function :
 $myPicture->setFontProperties(array("FontName"=>"/home/var/fonts/myfont.ttf");

By default, if no font is specified before calling a function that will draw text on your pictures, the library will try to locate the font file fonts/GeosansLight.ttf. If you‘ve moved your font folder in another place, this will generate an error message.

Recommended way of working

    Basically, the simplest configuration is to keep this kind of directory structure putting all the pChart classes in class folder, the fonts in the fonts folder and the external ressources (like pictures you want to includes or data sources) in the resources folder. You can leave your pChart scripts in the Library folder.

Keeping a simple folder structure will help you to debug and maintain your applications!


Prerequisites

To run on your web server, you need to ensure that apache has been configured with the GD library. This free library is most of the time integrated in the PHP installation you‘ve already made, only thing to do is to activate it from the php.ini file.

If GD support is not enabled in your PHP installation, you may see the following error message :
PHP Fatal error:  Call to undefined function imagecreatetruecolor()

On windows, uncomment the following line :
;extension=php_gd2.dll

On linux environment, you‘ll need to recompile PHP with the GD library. (usually with the --enable-gd command line switch)

How to check your current PHP configuration?

To see the configuration of PHP on your web server, make a file named test.php in the web directory root and write the following in it :
<?php   
 phpinfo();
?>
The presence of the GD library is tested in the pImage class by the following lines :
 if (!extension_loaded(‘gd‘) && !extension_loaded(‘gd2‘))
 {
   /* Extension not loaded */
 }

Hosted web services

If you‘re using an hosted environment that you are not managing, you may face a serious issue here. Depending of the quality of services offered by your web provider, GD support may be enabled or not. As the GD library can add an additional load on the backends (creating pictures can be CPU consuming), some providers will not allow it to be installed.
Last updated on 11/25/2010 
by Jean-Damien 
Linked resources
Community comments
Message from chpod1 on 19/04/2010
Where is the download page for 2.0?
Cheers, chpod1
Message from ram on 21/08/2010
Hi, man when we can download the pchart 2... waiting..... cheers.
Message from muzaaj on 30/12/2010
I want to download....
Message from Azhar on 04/05/2011
how to use this pChart? i getting error when try to include it on my script.. can help?
© Copyrights
Components used on this web site : Famfamfam icons has been made by Mark James, Rounded corners lite has been coded by Cameron Cooke and Tim Hutchison, SyntaxHighlighter has been written by Alex Gorbatchev. pChart and this web site have been created by Jean-Damien POGOLOTTI. This documentation contains 185 pages and 56 comments. 409 users have registered. This page has been rendered in 0,01 seconds. Wiki revision 1.37.