#native_company# #native_desc#
#native_cta#

Installing PHP-GTK on Linux Page 3

By John Starkey
on April 1, 2003

Checking your work
Since this is intended as a precursor to a series of PHP-Gtk articles, I’ll simply provide a quick cut and
paste script, to make sure everything is as nature intended.
Copy the following code into a file, in your home directory, named simple.php:

#!/usr/local/bin/php -q 

<?php

function quitApplication()

{

    
Gtk::main_quit();

}

dl'php_gtk.so' ) || die( 'Unable to load php_gtk module! YOU BROKE ME!n' );

$window = &new GtkWindow;

$window->set_title("PHP does GTK");

$window->set_default_size(gdk::screen_width()*.85,gdk::screen_height()*.85);

$window->connect'delete_event''quitApplication' );

$window->show_all();

Gtk::main();

?>



You may need to change the path to your PHP binary in the first line. This can be found by typing
‘which php’ at the command prompt. Once that’s done, at the prompt type:
~/simple.php
This should open a blank window. If so, you’re ready to move on. If not, back up and try again. As always,
if you run into a snag, you can find some help in our community
forums
.
In the next article we’ll deal with creating a more likable interface using Glade. Until then…
I’d like to thank Steph Fox from the PHP-Gtk team for her help with clarifying some of the info contained
in this article and the ones to follow. Everyone say “HI STEPH!!” 🙂