Frequently Asked Questions

What is PHP-GTK?

PHP-GTK is a PHP extension that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client side cross-platform GUI applications.

Why is it not working with the browser/web server?

PHP-GTK is not meant to be used in the Web environment. It is intended for creation of standalone applications (run via command-line, user's desktop, etc.).

How do I install PHP-GTK on Win32?

Download the latest binaries from gtk.php.net. The zip file contains all binaries needed to run core PHP-GTK, as well as extra features such as Glade/XML and Scintilla. Extract the files to a temporary directory and then copy them into the following locations:

For Windows 98/NT/2000/XP:

In your PHP directory (e.g., c:\php4):

In a test directory (e.g., c:\php4\test):

NOTE: You can install the php.ini into your Windows directory (i.e., c:\winnt or c:\windows) as indicated by the zip file, but it is often not a good option, depending on the installation. It is also no longer required; the php.exe (CLI version as of PHP 4.3.0) will search the working directory, e.g., c:\php4, as well as the Windows directory. Or you can specify your php.ini location in your command line statement with '-c' option, as given in the php_win example below.

For Windows 95:

PHP-GTK has not been tested on Windows 95 ... sorry.

Testing the installation

When the PHP-GTK files are installed, you can verify your setup using a DOS command line. A typical example would be: c:\php4\php c:\php4\test\hello.php

To avoid the DOS box, you can use the php_win executable, provided in the install file:

c:\php4\php_win c:\php4\test\hello.php

or

start c:\php4\php_win c:\php4\test\hello.php

or

c:\php4\php_win -c \php4\php.ini -f c:\php4\test\hello.php

If you have installed your php.ini file in your Windows directory, the -c option can be dropped. For more information on command line options, see 'Using PHP from the command line' on the main PHP site.

Troubleshooting

If you can't produce the hello window, try the following:

Tips/Tricks:

How do I use the buttons in GtkFileSelection?
// Create the dialog window:
    $fs = &new GtkFileSelection("Save file");

// Get a handle to the Ok button:
    $ok_button = $fs->ok_button;

// Connect a function:
    $ok_button->connect("clicked", "enddialog");

// Connect the destroy action on the dialog window:
    $ok_button->connect_object("clicked", "destroy", $fs);

It is not currently possible to do it this way:

// Create the dialog window
    $fs = &new GtkFileSelection("Save file");

// Connect a function
    $fs->ok_button->connect("clicked", "enddialog");

// Connect the destroy action on the dialog window
    $fs->ok_button->connect_object("clicked", "destroy", $fs);
How do I know which GTK Classes are supported?

The following code will show the defined classes. All the PHP-GTK classes will be listed along with one or two others.

$array = get_declared_classes();
while(list(,$classname) = each($array)) {
    echo $classname."\n";
}

See the in the PHP Manual for other useful functions.

Can I use Themes under Win32?

No, The Win32 GTK port does not currently support this.

Where do I go from here?

Check out the .