Just tested, this works on Ubuntu 10.10 Maverick Meerkat as well.
I have had to Google search to be able to install PHP-GTK completely, and I'm going to correlate everything into this how-to here. Hope it helps.
First, we need to install all the prerequisites to installing PHP-GTK:
Then we need to get the Cairo PHP extension (required to install PHP-GTK):Code:sudo apt-get install build-essential subversion php5-cli php5-dev libgtk2.0-dev libglade2-dev
Then we need to do the following step in order for the ./buildconf and ./configure commands to work when we're at the stage of installing PHP-GTK, the reason is (according to others), the newer libtool.m4 has been split into different files. To make PHP-GTK ./buildconf and ./configure to work (and subsequently get PHP-GTK installed), we need to concatenate the different files back into the libtool.Code:cd ~/Downloads svn co http://svn.php.net/repository/pecl/cairo/trunk pecl-cairo cd pecl-cairo phpize ./configure make sudo make install
You're almost there. However, we need to get the latest SVN version of PHP-GTK - if you get PHP-GTK source from PHP-GTK website, you will get an error similar to this:Code:cd /usr/share/aclocal sudo cp libtool.m4 libtool.m4~backup sudo chmod 777 libtool.m4 (start line) sudo cat lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 >>libtool.m4 (end line) sudo chmod 644 libtool.m4
error: duplicate ‘static’
...when running the make command. In PHP-GTK 2.0.1, this macro expands simply to “static”. This was because the ZEND_BEGIN_ARG_INFO() macros at the time didn’t mark the variables as static. This was introduced in 5.2.9. So it stands that if you compile PHP-GTK 2.0.1 against PHP 5.2.9 or later, you will get that duplicate static error. In the SVN repoistory, this was fixed. (thanks: http://devlog.mahcuz.com/2010/08/php...licate-static/)
To counter this problem, we obviously get the latest SVN version:
Once we've done that - we need to do a few more things (although, PHP-GTK is now installedCode:cd ~/Downloads svn co http://svn.php.net/repository/gtk/php-gtk/trunk php-gtk cd php-gtk ./buildconf ./configure make sudo make install).
In Ubuntu 10.04, /etc/php5/cli/conf.d/ and /etc/php5/apache2/conf.d/ are symlinks to /etc/php5/conf.d/, so we need to fix that:
Now we need to add the PHP-GTK and Cairo extensions to the php.ini file for PHP to recognise them: run php-config and find (near the start) the extension_dir line. It may say something like (or exactly like) this:Code: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/
That's where your PHP-GTK and Cairo files are that php.ini need to know about.Code:--extension-dir [/usr/lib/php5/20090626+lfs]
To find where your php.ini file is, go to Places -> Computer then select File System from the left. Click Go->Search For Files and search for your php.ini file. You may find two. Open each one and in gedit, look at application title bar and you'll see where the php.ini file is from. If it's in a cli directory, that's the one you need to add the extensions line in. Close it, bring the Terminal window back up and type:
(modify to where your php.ini file is, if applicable)Code:sudo gedit /etc/php5/cli/php.ini
Press CTRL + F and type Dynamic Extensions, you'll see a list of information about extensions and "commands" but with semi-colons at the start of them - these are comments. Just above where it says "Module Settings" wrapped around semi-colons, add the following;
This tells PHP what these files are called for PHP-GTK and Cairo within the extension_dir it's already aware of.Code:extension=php_gtk2.so extension=cairo.so
Once done, now it's time to test the PHP-GTK installation. Back in Terminal, type: php ~/Downloads/php-gtk/demos/phpgtk2-demo.php and a PHP-GTK application should load up.
If you have any problems, feel free to post. I'm sure someone will help.



Adv Reply



Bookmarks