HOWTO: Compile php-gtk2 for Lucid Lynx
This is a mini-howto i collected from various outdated sources & a little testing.
The php-gtk2 package is currently not provided in the ubuntu repositories, it also depends on the pecl extension cairo.
When finished, you should have php-gtk2 running with php 5.3.
First the dependencies:
Code:
sudo apt-get install build-essential subversion php5-cli php5-dev libgtk2.0-dev libglade2-dev libcairo2-dev re2c
Then install pecl cairo from svn:
Code:
svn co http://svn.php.net/repository/pecl/cairo/trunk pecl-cairo
cd pecl-cairo
phpize
./configure
make
sudo make install
Next, install php-gtk2 from svn:
Code:
svn co http://svn.php.net/repository/gtk/php-gtk/trunk php-gtk
cd php-gtk
./buildconf
./configure
make
sudo make install
Assuming all went well, configure the extensions to load with php5-cli.
IMPORTANT: in Ubuntu Lucid, /etc/php5/cli/conf.d/ and /etc/php5/apache2/conf.d/ is symlinks to /etc/php5/conf.d/
This means that if you install php_gtk2 in this directory, it will also load when php is ran from Apache,
causing server to crash. php_gtk2 is only meant to be run from the cli.
So first remove the symlink, make a ordinary cli/conf.d/ directory and copy the .ini files there:
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/
Then install php_gt2k + cairo extensions:
Code:
echo "extension=/usr/lib/php5/20090626/php_gtk2.so" | sudo tee /etc/php5/cli/conf.d/php_gtk2.ini
echo "extension=/usr/lib/php5/20090626/cairo.so" | sudo tee /etc/php5/cli/conf.d/cairo.ini
Finally, verify they load correctly
Code:
php -m | grep php-gtk
Good luck!
EDIT: fixes as suggested by Compyx
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Nice one! I finally got php-gtk working thanks to this howto.
A few comments:
You have a typo in your command to install the dependencies, it should read:
Code:
sudo apt-get install build-essential subversion php5-cli php5-dev libgtk2.0-dev libglade2-dev libcairo2-dev re2c
you had an 'l' too many in 'llibglade2-dev' and an 'l' too few in 'ibcairo2-dev'.
Echoing with sudo and IO-redirection doesn't work:
Code:
sudo echo "extension=/usr/lib/php5/20090626/php_gtk2.so" > /etc/php5/conf.d/php_gtk2.ini
bash: /etc/php5/conf.d/php_gtk2.ini: Permission denied
This can be fixed by running the command in a new shell:
Code:
sudo bash -c 'echo "extension=/usr/lib/php5/20090626/php_gtk2.so" > /etc/php5/conf.d/php_gtk2.ini'
With these fixes php-gtk installed fine. :)
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
Compyx
A few comments:
Thanks for your feedback! I updated the orginal post to reflect your suggestions
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
Compyx
Echoing with sudo and IO-redirection doesn't work:
Code:
sudo echo "extension=/usr/lib/php5/20090626/php_gtk2.so" > /etc/php5/conf.d/php_gtk2.ini
bash: /etc/php5/conf.d/php_gtk2.ini: Permission denied
This can be fixed by running the command in a new shell:
Code:
sudo bash -c 'echo "extension=/usr/lib/php5/20090626/php_gtk2.so" > /etc/php5/conf.d/php_gtk2.ini'
Or even better, using tee, that's what it's for:
Code:
echo "extension=/usr/lib/php5/20090626/php_gtk2.so" | sudo tee /etc/php5/conf.d/php_gtk2.ini
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
Bachstelze
Or even better, using tee, that's what it's for
even better, thanks!
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
I've installed Ubuntu 10.04 (Lucid Lynx) Desktop and followed this howto. But when I test my PHP GTK installation by typing "sudo make test" after "sudo make", every test will fail.
During the installation I can't see anything going wrong...
Any ideas?
I installed both packages to /opt.
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
magicbuntu
I've installed Ubuntu 10.04 (Lucid Lynx) Desktop and followed this howto. But when I test my PHP GTK installation by typing "sudo make test" after "sudo make", every test will fail.
During the installation I can't see anything going wrong...
On my machine all the tests fail as well, however, the installation goes fine and PHP GTK actually works. So, I assume, something is wrong with the test suite itself.
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
All tests failed with my install too, but php-gtk worked. Unfortunately I had to disable the extensions because none of my local websites would display anything with them enabled. In /var/log/apache2/error.log I noticed messages like these:
Code:
(page=mail&action=test:1238): GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
(index.php:1239): GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
I'm guessing not everything is working as it should. When compiling php-gtk I noticed some nasty compiler warnings about integers and pointers having different sizes and functions expecting pointers but getting integers, so perhaps php-gtk isn't 64-bit ready or not including the proper headers. I'll try to look into those issues when I can find the time.
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
Compyx
All tests failed with my install too, but php-gtk worked. Unfortunately I had to disable the extensions because none of my local websites would display anything with them enabled. In /var/log/apache2/error.log I noticed messages like these:
Code:
(page=mail&action=test:1238): GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
(index.php:1239): GLib-GObject-CRITICAL **: g_boxed_type_register_static: assertion `g_type_from_name (name) == 0' failed
I'm guessing not everything is working as it should. When compiling php-gtk I noticed some nasty compiler warnings about integers and pointers having different sizes and functions expecting pointers but getting integers, so perhaps php-gtk isn't 64-bit ready or not including the proper headers. I'll try to look into those issues when I can find the time.
Hello, I updated the first post with explanation & instructions how to install php_gtk2 for php5-cli only.
Your problem is the symlink that ubuntu has installed between apache's php extensions and php-cli extensions, so apache loads the php_gtk2 extension and crashes.
php5_gtk2 can of course not run from the webserver
Re: HOWTO: Compile php-gtk2 for Lucid Lynx
Quote:
Originally Posted by
martin_lindhe
Hello, I updated the first post with explanation & instructions how to install php_gtk2 for php5-cli only.
Your problem is the symlink that ubuntu has installed between apache's php extensions and php-cli extensions, so apache loads the php_gtk2 extension and crashes.
php5_gtk2 can of course not run from the webserver
After removing the symlink and creating a cli/conf.d directory everything works as expected. Thanks!