This forum has been archived. Please start a new discussion on GitHub.

Ice with PHP

Hi all,

I have a question, I have compiled Ice for PHP and received file IcePHP.dy instead of

Can anyone please spend explain how to use it and actually connect with php?



  • mes
    mes California

    The php/INSTALL file in the Ice source distribution contains instructions for installing the extension. This file does not contain instructions for Mac OS since that is not a supported platform for our PHP extension, but the instructions for Linux might help you to get it working.

  • Thanks, mes!

    I have read that file, but there is no single word about IcePHP.dy file, that's why I am asking.

    Please help if you know anything about it.

    Thanks again!
  • mes
    mes California
    IcePHP.dy is the shared library for the Ice extension. It is the equivalent of on Linux.

  • thanks a lot for the reply.

    now I added my php.ini with line

    and when I use php I am getting warning:
    Warning: PHP Startup: Unable to load dynamic library '/opt/Ice-3.4.1/php/IcePHP.dy' - dlopen(/opt/Ice-3.4.1/php/IcePHP.dy, 9): Library not loaded: /opt/Ice-3.4/lib/libIce.34.dylib
    Referenced from: /opt/Ice-3.4.1/php/IcePHP.dy
    Reason: image not found in Unknown on line 0

    I am using php5.3.4-dev

    please advice where I am wrong. Thanks!
  • bernard
    bernard Jupiter, FL
    Hi Oksana,

    It's looking for your Ice for C++ shared libraries in their default location (/opt/Ice-3.4). If you installed Ice for C++ somewhere else, you could create a symbolic link.

  • Hi Bernard!

    Super thanks for the reply.
    Can you please take a quick look into this error

    Call to undefined function Ice_loadProfile()
    but when I do
    php -m
    I can see ice there


    I have added t php.ini as well (file exists)
    ice.slice =

    from phpinfo() I can see

    [HTML]Ice support enabled
    Ice version 3.4.1

    Directive Local Value Master Value
    ice.con no value no value
    ice.hid 1 1
    ice.opt no value no value no value no value[/HTML]
  • oh, I found
    I should use
    require_once 'Ice.php';
    $ICE = Ice_initialize();
  • bernard
    bernard Jupiter, FL
    Hi Oksana,

    Good to hear you figure it out!

    Once you have Ice for PHP working on your Mac, it would be great if you could post step by step instructions, and maybe a patch (if code changes were needed). I am sure other Ice for PHP users would be interested.

  • Hi Bernard,
    yes of course.
      What we need

      # MacOS X (Intel 32 bit & 64 bit) Archive

      # Source Distributions
        Setup Process

        1. You have to compile Ice for C++ first.
        The easiest will be just untar Ice-3.4.1-bin-macosx.tar.gz and set ICE_HOME


        2. Untar Ice-3.4.1.tar.gz

        [PHP]cd php/config[/PHP]

        3. Edit Makefile.rules.php file (change path to your php installation/use namespaces/ feel free

        [PHP]PHP_HOME = /etc/apache2/php[/PHP]

        4. Copy Makefile.rules.Darwin from cpp folder to php

        [PHP]cp cpp/config/Makefile.rules.Darwin php/config[/PHP]

        5. Edit Makefile.rules.Darwin

        [PHP]\#LDPLATFORMFLAGS \+= \-rdynamic
        LDPLATFORMFLAGS = \-Wl,-bind_at_load
        \#ifdef ice_src_dist
        \# shlibldflags = $(CXXFLAGS) \-L$(libdir)
        \# shlibldflags = $(CXXFLAGS) \-L$(ice_dir)/$(libsubdir)
        shlibldflags = $(CXXFLAGS) ${wl}\-flat_namespace ${wl}\-undefined ${wl}suppress \-L$(libdir)[/PHP]

        6. Follow the sun (README) file

        make install[/PHP]

        7. And now you should have shared library for the Ice extension in a path specified by prefix variable in you Make.rules.php file.

        8. Connect your php with Ice installation. Add to you php.ini file


        9. Set DYLD_LIBRARY_PATH variable


        10. Check loaded modules (php -m) or

        11. Enjoy your Ice

          Good to know.

          There is a difference in initializing connection between Ice 3.3.x and 3.4.x

          Ice <= 3.3

          // initialize ice connection
          global $ICE;
          $base = $ICE->stringToProxy('$proxy');[/PHP]

          Ice >= 3.4

          For Ice 3.4 and later you’ll have to do a different approach.

          [PHP]require_once 'Ice.php';
          $ICE = Ice_initialize();
          $meta = $ICE->stringToProxy('$proxy');[/PHP]