Loading the php_gtk Module

In PHP-GTK 1, you never knew if the php-gtk module had been loaded into PHP automatically via php.ini, or if it was a bad setup (many of them!), and you had to load the module yourself:
<?php
if (!class_exists("gtk")) {
    dl( "php_gtk." . PHP_SHLIB_SUFFIX);
}
?>

In PHP 5, loading modules via dl() is deprecated. That means it still works, but people are encouraged not to do that any more. So you can assume that PHP-GTK is already loaded, or, if you want to catch all possible errors, check for the existance of the PHP-GTK module and throw an error if it's not there:
<?php
if (!extension_loaded('php-gtk')) {
    echo "The PHP-Gtk2 module is not available!\r\n";
    exit(1);
}
//..continue with your program
?>