Installation on Mac OS X

You need to make sure you have the Apple Developer Tools, BSD Subsystem, and an installation of X before you try installing PHP-GTK 2. Although the BSD subsystem is installed by default on Mac OS X, you need select the Developer Tools and X Server manually. Although you can use any X server, the easiest would be to use the one Apple provides by default on it's Mac OS X installer.

Get MacPorts (previously knows as DarwinPorts) or Fink and install it. You can use either to install a version of X (if you decided not to use Apple's default distribution), and Gtk+ itself. Both Fink and MacPorts provide versions 2.6 and above of Gtk+. Also make sure you have a version of PHP that is atleast 5.2, MacPorts provides a package. Type php -v on your Terminal to find out your version. If you want to manually compile PHP you can do so:

$ cvs -d :pserver:cvsread@cvs.php.net:/repository co -r PHP_5_2 php-src
$ cd php-src
$ ./buildconf
$ ./configure --disable-cgi
$ make
$ sudo make install
Although you may install it anywhere, /usr/local/ is usually considered a good place. MacPorts installs PHP into /opt/local/.

Now get the latest checkout of PHP-GTK and compile it:

$ cd..
$ cvs -d :pserver:cvsread@cvs.php.net:/repository co php-gtk
$ cd php-gtk
$ ./buildconf --with-phpize=/usr/local/bin/phpize
$ ./configure --with-php-config=/usr/local/bin/php-config \
            --disable-libglade
$ make
$ sudo make install
Remember to replace /usr/local/ with the actual directory in which you installed PHP. For example, if you installed PHP 5.2 using MacPorts, you would enter /opt/local/ instead.

Finally, copy over the php.ini-recommended file to /usr/local/lib/php.ini and change the value of extension_dir to the directory where php_gtk2.so resides. This is usually something like: /usr/local/lib/php/extensions/no-debug-non-zts-some-date. You may want to create a new symbolic link in /usr/bin/ that points to /usr/local/bin/php. Again, the directory may be /opt/local/ instead of /usr/local/ depending on where your installation of PHP resides.

Now continue with Testing your installation.