1.2. Installing
Prev | Chapter 1. PHPlot Installation | Next

## 1.2. Installing

Unpack the PHPlot distribution into a convenient directory. Recent releases of PHPlot are available both as ZIP files, and as gzip-compressed TAR files. Use whichever format is more convenient for you. In the example below, the TAR format is unpacked.

    $ tar -xvzf phplot-5.*.tar.gz
    $ cd phplot-5.*

(Use the appropriate filename.) Check the distribution for README and/or INSTALL files which may contain newer instructions.

The main source file for PHPlot is `phplot.php`. There are some configuration settings you can make at the top of this file using a text editor. An example would be to change the default output format from PNG to GIF. For most installations, no changes are needed. But if you want to use TrueType fonts in your plot images, you can make it easier by changing the following two default values in phplot.php:

$ttf_path

  This should be set to the pathname of the directory where you keep TrueType fonts. Setting this here means scripts can find the fonts without calling SetTTFPath or including a full pathname to the font file.

$default_ttfont

  This should be set to the filename of the TrueType font you want to use as a default for plots which enable TrueType fonts. You can specify just a filename without path, and the font will be found in the $ttf_path directory set above, or you can specify the full pathname of the font file. This provides a default for SetDefaultTTFont.

For example, you might change the settings in phplot.php to look like this:

      var $ttf_path = '/usr/local/share/fonts/truetype';
      var $default_ttfont = 'arial.ttf';

Installation of PHPlot simply involves copying three script files somewhere your PHP application scripts will be able to find them. The scripts are: `phplot.php`, `phplot_data.php`, and `rgb.inc.php`. Make sure the protections on these files allow the web server to read them. For example:

    $ chmod 644 *.php

Then, simply copy the three files into a directory where PHP scripts will be able to include them. The ideal place is a directory outside your web server document area, and on your PHP include path (that you noted above in the PHP Info report). You can add to the include path in the PHP configuration file; consult the PHP manual for details. For example, if `/usr/local/share/php` is on your PHP include path, you can install PHPlot with:

    $ cp phplot.php phplot_data.php rgb.inc.php /usr/local/share/php

Prev | Up | Next
Chapter 1. PHPlot Installation | Home | 1.3. Next Step