Chapter 2. The Short Version: Installing the library (for PHP/Apache experts)
| Part I. Installing and verifying the configuring |

## Chapter 2. The Short Version: Installing the library (for PHP/Apache experts)

What you will learn in this chapter. This chapter will show you how to unpack the library and lists the minimum prerequisites that is needed to get the library running. It is assumed that your are familiar with adjusting the PHP configuration file `php.ini` and that you already have a working PHP installation.

## Installing

Please follow the steps below:

1. Either download the free library from `http://jpgraph.net/download/` or use your license information and download the pro-version from `http://jpgraph.net/pro/login.php`. The download is just a packed zip (or tar.gz) of php files. There are no automatic installation scripts.

2. Unpack the library where you normally store PHP libraries. This should be in your PHP include path. When you unpack the library it will be named "jpgraph-3.x" (where x corresponds to the version you have downloaded).

3. Now either rename the unpacked the directory to just jpgraph or if the system us Unix based create a soft symbolic link, for example

   `ln -s jpgraph-2.x jpgraph`

   This will allow you to access the library files in your own program for with a `require_once('jpgraph/jpgraph.php')`

4. Make sure that the GD extension is enabled in your `php.ini` file (check the output from `phpinfo()` )

5. [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.

6. [Optional] Check that you have sufficient memory and execution time set in your `php.ini` file. It is recommended to allow at least 32Mb memory for PHP if you intend to run anything else than very basic graph scripts.

7. [Optional] To allow for better debugging in conjunction with graph scripts the output buffering should also be disabled in `php.ini`

8. [Optional] To avoid warning messages it might be necessary to set the default timezone in `php.ini` if this has not already been done. Starting with PHP 5.2 a warning is generated if the timezone for PHP is not set.

### Tip

When you install the library on a production server then you should not install the library in the document root. Instead it should be installed so that only the script can directly access the library files (somewhere in the PHP path).

If you have the pro-version you really should install the pre-compiled version of the library (available under directory `PhpExpress-src`. This will significantly increase the performance of the library. The only prerequisite is that you also need to install the (free) PhpExpress PHP Accelerator from NuSphere Corporation. See Chapter 11. NuSphere PHP accelerator for information on how to install the freely available PHP Accelerator.

| Up |
| Home |