DokuWiki

It's better when it's simple

User Tools

Site Tools


tips:phpwithgd

PHP and gdlib

Some plugins might use functions like ImageCreate or ImagePng or others to create PNG or JPEG images dynamically. In this case PHP must have been installed on your machine/webserver with gdlib support. Otherwise nothing will happen except no images are created. This means even so the required lib is not installed you might not see any warning or error messages.

Checking for gdlib support

If you install a file including the code

<?php phpinfo(); ?>

on your webserver and open the URL to the file in a browser, then information about the installed PHP version will appear. There should be a section with the heading GD. Otherwise gdlib is not installed.

You can also use the following code to have a simple and clear indication:

<?php
if (extension_loaded('gd') && function_exists('gd_info')) {
    echo "PHP GD library is installed on your web server";
}
else {
    echo "PHP GD library is NOT installed on your web server";
}
?>

If there is no gdlib installed, then you need to install it to make plugins work which require it.

Installing gdlib support for PHP

Please find installation instructions here. Please remember that a restart of the webserver might be required after installing gdlib support to make the change take affect.

Ubuntu

On Ubuntu just run

sudo apt-get install php5-gd

On CentOS just run

sudo yum install php-gd

FIXME Provide installation instructions for other OS

Plugins requiring gdlib

The following plugins are known to require gdlib:

tips/phpwithgd.txt · Last modified: 2021-02-09 06:11 by goldseed

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki