231. How to install php gtk2 on windows?


How to install PHP-GTK2 on windows platform?


Updated: March 1, 2008

Thanks to the PHP-GTK2 development team. Installing PHP-GTK2 is now as simple as 1-2-3. Yes, just download - unzip - and off you go!

  1. Download the zip file from http://gtk.php.net/download.php: php-gtk-2.0.0 Windows binary pack

  2. Extract the zip file. You will see a folder called "php-gtk2".
  3. That's it! Yes, that's it! PHP-GTK v2.0 is now ready to run!

Let's do some Test Run

  • First of all, you might want to move the "php-gtk2" folder to a desired location. Let's suppose you moved it to "c:\php-gtk2". Note: hereinafter, I will use c:\php-gtk2 to refer to the folder containing the php-gtk2 application.
  • Next, you might want to set the path to include this folder. I believe most of you have another PHP running for your web server. So when you just type php, most likely it will run the web version of PHP. If you want, you could rename the php.exe in this folder to, say, php-gtk.exe. Otherwise, everytime you want to run php-gtk2, you need to type the fullpath e.g. c:\php-gtk\php script.php.
  • Copy the following script and save them in a file, say "hello.php". Run the script with "c:\php-gtk2\php hello.php". You should see "hello world!" in a window.
  • <?php
    $window = new GtkWindow();
    $window->connect_simple('destroy', array('Gtk','main_quit'));
    $label = new GtkLabel("hello world!");

  • You may also want to try this script: How to draw a simple bar graph using GD2?
  • and see if you get:

    How to draw a simple bar graph using GD2?


  • If you are new to PHP-GTK2, you can try out PHP-GTK2 with the 400+ recipes available from this site.
  • If you are a seasoned PHP-GTK2 programmer, you may want to check out some of the new exciting PHP-GTK2 Functionalities with this new build of PHP-GTK2.

  • Although you can still use the Gnope Installer to set up PHP-GTK2, the Installer has not been updated for quite some time. And it doesn't include some libraries such as GD2. If you're starting new on PHP-GTK2, I would strongly encourage you to go straight to using the beta release.
  • If you want to add GtkHtml and GtkExtra, please refer to this article: PHP-GTK v2.0 - adding GtkHtml and GtkExtra.

Related Links

Sample Code




0 # mazzoni bruno 2012-09-02 06:25
very clear, very useful, very happy :-) :-) :-) :-) :-)
Reply | Reply with quote | Quote
0 # Frankz 2013-09-07 18:42
Thank you very much!
Reply | Reply with quote | Quote

Add comment

Security code