Laboratorium Komputerowe Progmar

We are using cookies in the page. If you use the page you agree for the cookies.      Close

Installing GTK+ binding for PHP

First we install prerequisite packages: sudo apt-get install build-essential subversion php5-cli php5-dev libgtk2.0-dev libglade2-dev

Next we install Cairo library:

cd ~/Downloads
svn co pecl-cairo
cd pecl-cairo
sudo make install

Now to properly compile php-gtk library we have to make following changes:

cd /usr/share/aclocal
sudo cp libtool.m4 libtool.m4.backup
sudo chmod 777 libtool.m4
sudo cat lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 >>libtool.m4
sudo chmod 644 libtool.m4

Now we download, compile and install php-gtk library:

cd ~/Downloads
svn co php-gtk
cd php-gtk
sudo make install

The last step is configuring php-cli to point to proper php-gtk extension location. In order to do this we have to divide php-cli and php-apache configuration files:

sudo rm /etc/php5/cli/conf.d
sudo mkdir /etc/php5/cli/conf.d
sudo cp /etc/php5/conf.d/*.ini /etc/php5/cli/conf.d/

Now edit /etc/php5/cli/php.ini file and add following lines in Dynamic Extensions section:

Everything is installed and configured now. Check proper working of php-gtk library by running example application: php ~/Downloads/php-gtk/demos/gtkiconview.php