Installing PHP-GTK Under Unix
Debian users can now download a PHP-GTK binary from
http://www.debian.org/.
PHP GTK depends on a number of packages, which need to be installed before
starting the PHP-GTK installation:
PHP version 4.3.4 or later
The GTK+ libraries, available from
http://www.gtk.org/download/, or you can
use the packaged versions for your system, e.g. gtk
and gtk-devel
libtool, automake and autoconf. The combination of libtool 1.4.2,
automake 1.4 and autoconf 2.13 is known to work; mileage may vary
with other version combinations.
For the optional extras, download
GtkHTML libraries,
GtkScintilla libraries and
Gdk-Pixbuf libraries. Again, these
may be available packaged on your system, just ensure that you also
install the development package. GtkHTML, notably, has a number of
sub-dependencies, e.g. GAL, that can also be
obtained from the Gnome ftp site.
We suggest you get the latest source from
http://gtk.php.net/ or from anonymous CVS
http://www.php.net/anoncvs.php.
The wiki contains an
installation howto with
screenshots describing how to install PHP-Gtk from CVS verbosely.
Run the ./buildconf script that is inside the
distribution. This will set up the necessary files and create the
configure file. Next, run
./configure. This will check that you have a correct
version of GTK+ 1.2.x (1.2.6 or above, available from
http://www.gtk.org/download/) and other files
required for compilation, and will then create the needed Makefiles.
./configure can also be used to build the extra
widgets, e.g.
./configure --enable-scintilla --enable-gtkhtml. To
list all the available options use ./configure --help.
Remember that each extra widget may have a number of dependencies
that need to be available for the build to be successful.
Finally, run make to compile the extension. Some
source files are generated from .defs files by the code generator. If
you see messages like "Could not write...",
it means that the listed GTK+ objects or features are not yet supported.
If the compilation is successful, run make install to
install the extension into your default PHP extension directory (usually
/usr/local/lib/php/extensions).
Troubleshooting: common problems from ./configure or
make
If you get a ./configure: line 3027: `PHP_GTK_ARG_ENABLE(debug,
whether to include debugging symbols,' after doing the
./configure, you just have to do the following:
./buildconf
aclocal
./buildconf
./configure
|
./ltconfig: ltconfig : No such file or directory, configure:
error: libtool configure failed is caused by not having
one of libtool, automake or autoconf installed.
./aclocal.m4:813: error: m4_defn: undefined:
_m4_divert_diversion is caused by an incompatible version
of autoconf, see the recommended versions above.
php_gtk+.c:33: parse error before `TSRMLS_DC' is
caused by either an old version of php being found by the build system
or trying to build php-gtk with an old version of PHP - please upgrade
to PHP version 4.3.4 to fix this.
gen_gtk.c:1: parse error before '<' is caused by
an error occurring in the generator. Usually this error is resolved by
adding the line
ini_set("memory_limit", "32M");
to the first line of generator/generator.php. You
will need to remove all the gen_* files from all
directories after changing this.
checking for gnome-config... Unknown library `gtkhtml'
(from ./configure) is due to an old or unavailable
development header file - if you installed by rpm or a similar package
system you will need the -devel packages
Unable to find -lgal or similar message is caused
by a missing gal-devel or similar library. Usually
this will be a sub dependancy of some of the more complex widgets, like
gtkhtml.
To test the extension, try running the example scripts in the
test/ directory. These also provide demonstrations
of some of the ways in which PHP-GTK and its extensions can be used.