Home > Information Technology | Linux System > EXTENDING PHP WITH PHP-GTK

EXTENDING PHP WITH PHP-GTK

We can use PHP to make a desktop application, by adding GTK extension. These are what we have to do:
1. Prepare the file
Requirement:
- checkinstall
- php5-cli (PHP5 Command Line Interface)
- php5-dev
- libglib2.0-dev
- libgtk2-dev
Download PHP-GTK-20.beta.tar.gz

2. Unzip and get into the folder:
# tar xzf php-gtk-2.0.0beta.tar.gz
# cd php-gtk-2.0.0beta

3. Compile and Install
# ./buildconf
# ./configure
# make
# checkinstall

4. PHP-CLI configuration:
Add the following line in /etc/php5/cli/php.ini:
extension=php_gtk2.so

5. Testing
Make phpgtk_test.phpw in your home directory, and fill with these following lines:
<?php
$window = new GtkWindow();
$window->connect_object('destroy', array('gtk', 'main_quit'));
$dateTime = new GtkLabel(date('Y-m-d H:i:s'));
$window->add($dateTime);
$window->show_all();
gtk::main();
?>

Execute the file:
$ php phpgtk_test.phpw

The following window will appear:

PHP-GTK

More reference:
- pear.php.net

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Trackbacks:0

Listed below are links to weblogs that reference
EXTENDING PHP WITH PHP-GTK from Aji's Journal
TOP