Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: HOWTO: Compile php-gtk2 for Lucid Lynx

  1. #1
    Join Date
    Jul 2007
    Location
    Sweden
    Beans
    24

    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
    Last edited by martin_lindhe; May 10th, 2010 at 08:43 AM. Reason: updated install instructions

  2. #2
    Join Date
    Mar 2006
    Location
    Eefde, The Netherlands
    Beans
    432
    Distro
    Ubuntu 10.04 Lucid Lynx

    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.
    "When in doubt, use brute force."

    -- Ken Thompson

  3. #3
    Join Date
    Jul 2007
    Location
    Sweden
    Beans
    24

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by Compyx View Post
    A few comments:
    Thanks for your feedback! I updated the orginal post to reflect your suggestions

  4. #4
    Join Date
    Nov 2005
    Location
    Bordeaux, France
    Beans
    11,297
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by Compyx View Post
    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
    「明後日の夕方には帰ってるからね。」


  5. #5
    Join Date
    Jul 2007
    Location
    Sweden
    Beans
    24

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by Bachstelze View Post
    Or even better, using tee, that's what it's for
    even better, thanks!

  6. #6
    Join Date
    May 2010
    Beans
    1

    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.
    Last edited by magicbuntu; May 8th, 2010 at 07:26 PM.

  7. #7
    Join Date
    May 2010
    Beans
    4

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by magicbuntu View Post
    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.

  8. #8
    Join Date
    Mar 2006
    Location
    Eefde, The Netherlands
    Beans
    432
    Distro
    Ubuntu 10.04 Lucid Lynx

    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.
    "When in doubt, use brute force."

    -- Ken Thompson

  9. #9
    Join Date
    Jul 2007
    Location
    Sweden
    Beans
    24

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by Compyx View Post
    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

  10. #10
    Join Date
    Mar 2006
    Location
    Eefde, The Netherlands
    Beans
    432
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Compile php-gtk2 for Lucid Lynx

    Quote Originally Posted by martin_lindhe View Post
    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!
    "When in doubt, use brute force."

    -- Ken Thompson

Page 1 of 4 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •