Chapter 1. PHPlot Installation

Abstract

This chapter explains how to install PHPlot.

1.1. Prerequisites

Before you can use PHPlot, you need a recent version of PHP with the GD extension. PHPlot-5.0.4 and earlier require at least PHP version 4.3.0, and PHPlot-5.0.4 was tested with PHP-4.4.7 and PHP-5.2.4. PHPlot-5.0.5 and up will only support PHP5, since PHP4 reached its official end-of-life as of the end of 2007. In general, you should always use the latest available version of PHP5.

If you want to display PHPlot charts on a web site, you need a PHP-enabled web server. You can also use PHPlot with the PHP CLI (command line interface) without a web server.

You need the GD extension to PHP either built in to PHP or loaded as a module. The version of GD which is bundled with recent versions of PHP will work fine.

If you aren't sure what extensions you have in PHP, create this PHP script called phpinfo.php somewhere in your web server's document tree:

<?php phpinfo(); ?>

Access this page with your browser to view your PHP configuration. Look for the section labeled 'gd'. If you have no 'gd' section in the PHP Info output, you don't have the required 'gd' extension. Consult the PHP documentation to find out how to get it. Here's what the GD section of the PHP Info listing might look like:

GD section of PHP Info listing

The text in the 'gd' section of the PHP Info output will tell you what version of GD you have (you need 2.0 or higher), and what output formats it supports. Check the table for PNG Support, since PNG is the default output format for PHPlot. If you want to create GIF or JPEG (JPG) format images, check the table to see if they are available. If the image formats you want are not available, you will have to rebuild PHP.

Another thing to look for in the 'gd' section of the PHP Info output is FreeType Support. If you have it enabled, you can use TrueType fonts in PHPlot. If your GD does not have FreeType support enabled, you can still make decent-looking plots with PHPlot, using the built-in GD fonts. Note that even if you have FreeType Support enabled, you need some actual TrueType font files in order to use TrueType fonts with PHPlot. PHPlot does not include any TrueType font files.

While you have the PHP Info report up, look in the Configuration section for PHP Core, at the top of the report, and make a note of the include_path setting. If you have a local include directory in this path, you can use it for installing PHPlot, as described below.

Note

Don't leave the phpinfo.php file in your web server document tree, as there may be security implications in the information it tells people about your web server.

Once you have a web server with PHP and the GD extension, you are ready to install PHPlot.