Installing PHP-GTK on Windows

Installing PHP-GTK

Installing recent (as of Nov 2009) versions of PHP-GTK seems to be a little tricky. If you want to have PHP-GTK, Glade support, and MySQL support, it looks like you need to download and merge THREE different downloads.

I'm not sure why this has to be. I can see that maybe the PHP-GTK builds need to be separated from the "standard, webby" PHP builds. But I don't see why all the PHP-GTK extensions (ex. including Glade) can't be bundled in with the "plain" PHP-GTK package. Then we just have to merge in stuff from the "webby" PHP build. Nevertheless, I appreciate the work the PHP-GTK folks put into the project.

Anyway, the following is what worked for me.

First, get the "standard PHP-GTK" from http://gtk.php.net/download.php. The file was labeled :

- php-gtk-2.0.1 Windows binary pack - 16-May-2008

Next, get Glade and other GTK extensions from http://gtk.php.net/download.php. The file was labeled :

- php-gtk-2.0.1 Windows binary extensions pack - 16-May-2008

Finally, get MySQL and other extensions (ex. SOAP, cURL) from http://www.php.net/releases/ by downloading this file :

- http://museum.php.net/php5/php-5.2.6-nts-Win32.zip

In the last step, note we're downloading "standard, webby" PHP 5.2.6. This is to match the PHP-GTK binary we got above. Note you must download the NTS (non-thread safe) version. This again is to match the GTK php binary above which is also non-thread safe. This is detailed in the PHP-GTK "standard" README.txt, but you can't read that until you've downloaded it! ;-)

By downloading and inspecting the two PHP-GTK binaries, it looked like there was no "overlap" between the two distributions -- every file was unique in the respective distribution, so you didn't have to guess as to which file was the right one to use if and when you merged the two.

I found it best to use Git with three branches (merged into a master) to manage this. Using Git is a bit of overkill, and since there's no "overlap" you should be OK just dropping thing into their respective folders, but I find using Git makes things cleaner.

First, unzip the above three downloads in a temporary area. Then make this empty folder where you'll merge everything together : C:\Programs\php-gtk

Perform the following in this directory :

C:\Programs\php-gtk>git init
C:\Programs\php-gtk>touch .gitignore
C:\Programs\php-gtk>git add .
C:\Programs\php-gtk>git commit -a -m "Initial commit of .gitignore only"
C:\Programs\php-gtk>git checkout -b gtk
Switched to a new branch "gtk"

>> Now drag files from the temporary, unzipped PHP-GTK folder into your C:\Programs\php-gtk folder <<

Your git status will show all the newly added files :

C:\Programs\php-gtk>git status
On branch gtk
Untracked files:
(use "git add ..." to include in what will be committed)

COPYING.LIB
NEWS
README.txt
debug/
demos/
etc/
ext/
intl.dll
jpeg62.dll
lib/
libatk-1.0-0.dll
...
libtiff3.dll
php-cli.ini
php-win.exe
php.exe
php5.dll
share/
zlib1.dll
Nothing added to commit but untracked files present (use "git add" to track)

C:\Programs\php-gtk>git add .

C:\Programs\php-gtk>git commit -m "Add in all files from PHP-GTK standard distro"

Do a diff between your gtk branch and the (currently empty) master branch to see what you added to the GTK branch :

C:\Programs\php-gtk>git branch -va
* gtk bae6f95 Add in all files from PHP-GTK standard distro
master 4f48b49 Initial commit of .gitignore only

C:\Programs\php-gtk>git diff --stat master gtk
COPYING.LIB | 458 +++++++++++++++
NEWS | 32 +
README.txt | 62 ++
debug/php_gtk2.pdb | Bin 0 -> 4293632 bytes
demos/Thumbs.db | Bin 0 -> 6144 bytes
...

NOTE : Before doing the merge, you'll have to close your Explorer window if it's displaying the contents of the merge directory (C:\Programs\php-gtk). Otherwise Explorer will "lock" the directory preventing the merge and give you an error like "git fatal: cannot create directory".

C:\Programs\php-gtk>git merge gtk

C:\Programs\php-gtk>git merge gtk-ext
Auto-merging README.txt
CONFLICT (add/add): Merge conflict in README.txt
Automatic merge failed; fix conflicts and then commit the result.

C:\Programs\php-gtk>git merge -s ours gtk-ext
Merge made by ours.

Categories: 

There is 1 Comment

i.e. say i used win explorer to copy and paste these packages...what do i do.

currently i download the all the packages you have.

then i put my gtk-php into:
c:/php-gtk/

then put the extensions folder into

c:/php-gtk/

then i put the php- download into

c:/php-gtk/

so all downloads are merged into one folder
is that right?