Requirements:
- Ubuntu Gutsy Gibbon
- Additional programs: checkinstall, PHP5, PHP-Devel
Compiling and Installing
- Install libgtk2.0-dev and its required packages.
- Download PHP-GTK (I use PHP0-GTK 2.0) and then compile it:
./buildconf
./configure
makeIf you are asked for phpize, then it means you have to install php-devel.
- Convert this binary into .deb package for easier removal (if you want to remove it later):
checkinstall - Add the following line in the php5.ini (for CLI, not Apache):
extension=php_gtk2.so
Optional packages:
- Libglade : A package to help make designing the layout easier.
- Scintilla : A powerfull text editing widget.
- GdkPixbuf : A package for manipulating and drawing images in a GTK-based application.
- GtkHTML : A widget for displaying HTML like a web browser. GtkHTML has a number of dependencies. Make sure you install all of those first.
For rapid development, use Glade to build GUI. If you got error like this:
function not found GladeXML()
Try to install some Glade package, then recompile and reinstall your PHP-GTK.
Testing
Make PHP file with the following content:
<?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();
?>
Save it to test.php, and try execute it by typing on shell:
php test.php
If there isn’t any new window appear, your installation may fail.