Chapter 1. PHPlot Installation

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.8.0 and later require at least PHP-5.3. (See the README and NEWS files included with the PHPlot distribution for requirements of other versions.) In general, you should always use the latest available stable version of PHP.

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 GD extension to PHP is included with PHP source releases, and is also included in the binary Windows releases (as a loadable module). The PHP GD extension uses the GD library (libgd). A version of the GD library is included with PHP releases, and use of this version is recommended, but you can also use the PHP GD extension with a separate GD library (for example, one included with your operating system).

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. (The extension is either missing, or the module was not loaded.) Consult the PHP documentation to find out how to get it loaded. 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 (or rebuild the GD extension).

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.

SourceForge.net Logo

This version of the manual was produced for the PHPlot Sourceforge project web service site, which requires the logo on each page.

To download a logo-free copy of the manual, see the PHPlot project downloads area.