#native_company# #native_desc#

Getting Started with PHP-GTK: Part 1

By Ray Hunter
on August 26, 2004

With the release of PHP5, there has been renewed interest in the PHP-GTK extension.
What does the PHP-GTK extension provide? “PHP-GTK implements language bindings for GTK+.”
PHP-GTK provides the means for a developer, familiar with PHP, to create rich clients using the
PHP programming language.
Installation has already been cover in John Starkey’s article
“Installing PHP-GTK on Linux”. If you have
not already read this, I would highly recommend it. There are a few comments I’d like to add to the installation process.
Let me point out that the website gtk.php.net has the same
documentation layout as does PHP and the quality of the documentation is also top notch.
I also highly recommend reading the installation
section of the documentation for both Windows and Linux users. For those users of Gentoo, my favorite
distro, there is an ebuild that works great too.
Verify Installation
To verify the installation we need to create a simple script that will test whether the
extension is loaded and, if not, will load the extension. The script is as follows:


if(!extension_loaded('php_gtk')) {

$loaded dl('php_gtk.'.PHP_SHLIB_SUFFIX);

  } else {

$loaded true;


"Extension loaded: ";

  echo (
$loaded) ? "truen" "falsen";


This will produce either an “Extension loaded: true” or “Extension loaded: false”.
If the extension is loaded into PHP then you can move to the next section. Otherwise
review the installation instructions at the PHP-GTK website.