Installing GTK on Ununti
| From: | Charles Esson | Date: | Sat, 10 Feb 2007 01:59:49 +0000 |
| Subject: | Installing GTK on Ununti | ||
| Groups: | php.gtk.dev | ||
| Request: | Send a blank email to php-gtk-dev+get-3703@lists.php.net to get a copy of this message | ||
Your making it pretty hard to help with the documentation. Heres some wiki text on how to install on ubuntu. There are errors in your linux install tutorial.
Regards
----------------------------------------------------------------------------------------------------------------
This is based on a fresh install of ubuntu 6.10 that came with the magazine [http://www.linuxuser.co.uk/ linuxuser and developer] issue 68. The aim is to get the install to a point where you can run the [http://gtk.php.net/docs.php PHP-GTK tutorials].
=Introduction=
Installing PHP-GTK is a four step process.
#Bringing the C/C++ development environment up to a standard that will compile PHP.
#Installing the needed libraries.
#Downloading and compiling PHP as required for PHP-GTK
#Compiling PHP-GTK
=Installing standard C++ development environment=
==Download and install the packages==
Use Synaptic to download and install the following packages to bring the development environment up to scratch.
cvs
autoconf
g++
bison
re2c
==Compiling flex==
The packaged version of flex is 2.5.33 you need 2.5.4a ( an older version). This you have to compile from source. The source is available from [http://prdownloads.sourceforge.net/flex/flex-2.5.4a.tar.gz?download flex version 2.5.4a in tar.gz format].
Download, unzip and place in home folder using your preferred method.
$ cd flex-2.5.4
$ ./configure
$ make
$ sudo -i
# cd ..
# cd /home/your_user_name/flex-2.5.4
# make install
# cd ~
# exit
$ cd ..
=Getting the needed libraries=
As a general rule you need the libraries that end in -dev. Use Synaptic to download the following development libaries.
libxml2-dev
libglade2-dev
==Getting lemon==
Lemon is not required for the tutorial but if you do require options that use lemon; in the synaptic application click the menu item '''Setting->repositories''', select '''Community maintained Open source software'''. Use Synaptic to download
lemon
= compiling PHP=
This is based on the PHP-GTK tutorial with additions and corrections.
==logon to the repository==
$ cvs -d :pserver:cvsread@cvs.php.net:/repository login
When the password is requested push return.
==Get the code==
$ cvs -d :pserver:cvsread@cvs.php.net:/repository co -r PHP_5_2 php-src
==compile and install==
$ cd php-src
$ ./buildconf
$ ./configure --prefix=/opt/php5_2 --disable-cgi
$ make
$ sudo -i
# cd ..
# cd /home/your_user_name/php-src
# make install
# echo extension=php_gtk2.so >> /opt/php5_2/lib/php.ini
# /opt/php5_2/bin/php-config --extension-dir | xargs echo 'extension_dir=' >> /opt/php5_2/lib/php.ini
# cd ~
# exit
$
=compiling PHP-GTK 2=
$ cd ..
$ cvs -d :pserver:cvsread@cvs.php.net:/repository co php-gtk
$ cd php-gtk
$ ./buildconf --with-phpize=/opt/php5_2/bin/phpize
$ ./configure --with-php-config=/opt/php5_2/bin/php-config
$ make
$ sudo -i
# cd ..
# cd /home/your_user_name/php-gtk
# make install
# ln -s /opt/php5_2/bin/php /usr/bin/php
# cd ~
# exit
$
Testing the install
$ php -m | grep php-gtk
You should get the output php-gtk.
=Running tutorial code=
==Simple hello==
Cut example 2.1 and save in a file name hello1.phpw
$ php hello1.phpw &
If you get a new window that works
==Advanced Hello==
Cut the code in example 3.1 and save in a file hello2.phpw
$ php hello2.phpw &
If you get a new window that works
==Glade hello==
Cut the text in 4.1 and save in a file helloglade.glade
Cut the code in Example 4.2 and past in hello3.phpw
$ php hello3.phpw &
If you get a tiny little window then you have the glade module installed. Happy tutorial.
=Using Nautilus in root=
If you make a mess and your not into using the command line to tidy up the root file system the following works.
$ sudo -i
# nautilus
# exit
$