PHP-GTK2 Newsletter
|
Sample Code 231: How to install php gtk2 on windows? |
| Written by kksou | ||||
| Monday, 14 May 2007 | ||||
|
Problem Solution 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!
Let's do some Test Run
<?php
$window = new GtkWindow();
$window->connect_simple('destroy', array('Gtk','main_quit'));
$label = new GtkLabel("hello world!");
$window->add($label);
$window->show_all();
Gtk::main();
?>
Note
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. Related Links
Sample Code Explanation User reviews Average user ratings: 3.0 (from 17 users) Note: You have to be a registered member to leave a comment. Free registration here. |
||||
| < Prev | Next > |
|---|







3.0 (from 17 users)
May 23, 2007 6:43pm
Great! These instructions work. I've been trying to figure out how to do it on my own to no avail...
However, when you set up the php.ini to include the other PHP-GTK extensions (like php_gtk_extra2.dll), it gives me many errors. Mostly they complain about not being about to find php-gtk2.dll. Any idea what that's about?
May 24, 2007 7:43am
Right, I couldn't get php_gtk_extra2.dll to work too...
May 24, 2007 12:34pm
Well, none of them work except php_gtk_libglade2.dll. I really want to use GtkStatusIcon, and without those extra extensions, it doesn't work. Any suggestion as to how to get them working?
May 28, 2007 12:08pm
Here's some additional hints - you can get a ready to go gtk runtime at http://perisama.net/libs/gtk/gtk-2.10-runtime-full.zip
That includes everything needed for all extensions, plus the svg pixbuf loader for windows. Unzip that, rename it whatever you want (php-gtk2 is always a good choice), and then dump your php5.2.2-min-all contents inside, put your php-cli.ini in, and away you go.
php_gtk_extra2.dll had an error in cvs (that's why it wasn't working properly), it should now be fixed. Remember to separate the list of php-gtk2 extensions you want loaded by using commas
php-gtk.extensions = php_gtk_extra2.dll
,php_gtk_libglade2.dll,php_get_libsexy2.dll
May 29, 2007 10:03pm
Elizabeth, thanks for the file gtk-2.10-runtime-full.zip. It simplies the setup a lot!
May 29, 2007 10:04pm
nomexous, Elizabeth has updated the package. It's working now - including GtkStatusIcon and GtkExtra (GtkSheet, GtkPlot, etc.) And she has now made the setup much easier. You just need to download 2 files, unzip, and off you go! I have updated the steps above. Let me know if you bump into any problems.
June 21, 2007 1:26pm
When following the steps outlined above, I kept getting errors about a missing libatk-1.0-0.dll when trying to run the hello world example. What wasn't clear to me was that I not only needed to download the PHP-5.2.2-min-all.zip, but also the gtk-2.10-runtime-full.zip and put them both in the same directory (php-gtk2 in my case).
June 21, 2007 6:08pm
Have just revised the step. Hope it's a bit clearer this time. Just proceed to download those two files - one contains the core php-gtk2 files. The other contains all the required gtk libraries. If you download these two files and put them in the folder as described above, you should not get the error.
July 31, 2007 9:14am
Thanks for this information which is working fine. Just a little note : since you added
extension = php_mysql.dll
in the php.ini, probably users will get the error I had about a missing libMysql.dll
I just added this file in the main directory, and everything is working fine (I have an application which is a gui for a mysql database). This dll is not present in the zip of Elisabeth. I don't know if it is intentionnal or just forgotten.
August 03, 2007 12:55am
Hi, really need help in installing php-gtk2. I tried the instructions above but it complains about not being able to find php-gtk2.dll. Thanks in advance
August 03, 2007 1:37am
Please disgard my first message. PHP-GTK works fine now. I cut and paste the missing dll from another php folder. Cheers
August 29, 2007 3:37am
I have tried several times to follow your instructions to the letter.
When i unzip both zip files to c:/php-gtk2 i get the directory structure
c:\php-gtk2
. . .ext
. . .gtk-2.10-runtime-full
. . . . . etc
. . . . . lib
. . . . . share
Then not even hello.php will work.
Where am i going wrong?
Thanks for all the info.
Extremely valuable.
Rob
August 29, 2007 7:48am
Hi Robert, if you have installed php-gtk2 in c:\php-gtk2, open up a cmd window and type: c:\php-gtk2\php -vWhat did you see? Any error message?When you follow step 6 above "c:\php-gtk2\php hello.php" (please type the full path and not just php hello.php), what error message did you get? If it's still not working, please drop me a message via the feedback form. I'm more than willing to help you zoom in where's the problem via email. Regards, /kksou
August 30, 2007 3:35am
Tx for your response. . . Keying in c:\php-gtk2\php -v . . . gave me . . . PHP 5.2.2(cli) . . etc. . (built: May 29 . . etc . . . Copyright . . . etc . . .
Zend Engine v2.2.0. Copyright . . etc . . . From a random directory, keying in . . . c:\php-gtk2\php c:\php-gtk2\hello.php. . . gave . . . Fatal error: Class 'GtkWindow' not found in c:\php-gtk2\hello.php . . . In the install steps you say 'dump' everything into c:\php-gtk2\, and i don't know exactly what that means in detail. I took it to mean 'unxip' everything to c:\php-gtk2\ as the base directory. It bothers me that i have not ended up with your exact directory structure. . . . I recently got hello, bargraph and other test programs going, but that was by grabbing chunks of files from various folders, and copying them into c:\php-gtk2\.
I did not manage however to get Scribble going.
I had to go back to php4 to get that one to work. . . . My real aim in all this is to write a drawing program with lines, circles, importing existing images, etc
in black and white, a bit like PaintDotNet.exe, then be able to write an image of it to a file for later printing. If it turns out that i can't do it using PHP i'll have to resort back to java. . . Looking forward to a clean install with your assistance, for which i am grateful.. . Cheers, Rob
August 30, 2007 7:04pm
Hi Robert, I did another round of test of the various installation packages available, and found the beta-release available from the official php-gtk2 site the easiest and fastest. I've just revised this article. Now 2 steps only - download and unzip. That's it! Please give it a try and let me know if it works. Regards, /kksou
August 30, 2007 9:27pm
Brilliant!. . . I followed your 2 steps and everything works. . . This is what i did in detail as it may help someone out there . . . Create 2 empty directories c:\phpEmpty and c:\php-gtk2 . . . Click on the link at http://gtk.php.net/download.php as directed in Step 1. . . Choose the Save option and save in c:\phpEmpty. . . In the 'Download Complete' dialogue box choose Open which automatically loads WinZip. . . Ctrl-A to select everything in the zip file. . Extract to c:\phpEmpty. . . This will create a subdirectory in phpEmpty named php-gtk (as in Step 2). . . Select this new subdir in the left-hand panel of your browser which will list out all the contents in the right-hand panel. . . Highlight everything in the right-hand panel and drag the lot to c:\php-gtk2. . . Install complete. . . By the way kksou, your bargraph probably gives me everything i am looking for. . . I have some experience in Visual C++ and Java but have just purchased your Demystified book on approval. . . Keep up that enthusiasm, Rob2168
June 05, 2008 4:59am
please help me for install it in linux.thanks