Archived

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

Configuration problems with PHP

Hello!

I am new with PHP and I am trying to test a simple example of PHP client. I use Debian etch/sid, Apache 2.0, PHP 5.1.4-0.1, and Ice 3.1.0 (using Debian Sid repositories).

I specify the following line in the /etc/php5/apache2/php.ini:

ice.slice=/var/www/test.ice

but when I try to test the simple example (using a web browser), I obtain the following error:

Fatal error: Call to undefined function Ice_loadProfile() in /var/www/test.php on line 12

I have studied the examples included in the IcePHP distribution, but I have not found any difference.

Thank you,
David.

Comments

  • mes
    mes California
    Hi,

    The error message indicates that the Ice extension for PHP has not been loaded. Examine your php.ini file to determine the extension directory (defined by the extension_dir directive) and copy icephp.so into that directory. Then you'll need to add the following line to php.ini:

    extension = icephp.so

    Hope that helps,
    - Mark
  • Hello,

    I installed the Debian package php-zeroc-ice (using the repositories of Debian Sid), but I can't find the icephp.so file in /usr/lib. However, in the /usr/lib/php5/20051025/ directory there is a ice.so file, but it doesn't work if I use it to load the Ice extension for PHP (the Apache2 web server doesn't start).

    Some idea?

    Thank you,
    David.
  • marc
    marc Florida
    I'm afraid you'll have to ask this question the Debian Ice maintainer. The Debian port is not from ZeroC. See http://packages.debian.org/unstable/devel/zeroc-ice.
  • Hello again!

    I have solved the problem with the Ice extension for PHP, but I have a simple question. Where can I find an example of a PHP script in which I establish a connection with Glacier? Here is the code I have to port using Python:

    router = Glacier2.RouterPrx.checkedCast(self.communicator().getDefaultRouter())
    session = router.createSession('user', 'password')

    Regards,
    David.
  • mes
    mes California
    Hi,

    To access Glacier2 from a PHP script, you'll need to define the Ice.Default.Router property in your IcePHP configuration. You'll also need to load the Glacier2 Slice files. In your script, you can do the following:
    $prop = $ICE->getProperty("Ice.Default.Router");
    $router = $ICE->stringToProxy($prop)->ice_checkedCast("::Glacier2::Router");
    $session = $router->createSession(...);
    
    Hope that helps,
    - Mark
  • Sorry for being so insistent, but I can't load the Glacier2 Slice files I need. My php.ini file is the following:

    ice.config=/var/www/masyro/agent.cfg
    ice.slice=-I/usr/share/slice/Glacier2/Router.ice /var/www/masyro/MASYRO.ice

    extension_dir = "/usr/lib/php5/20051025"
    extension = ice.so

    Apache2 starts correctly (it doesn't show any error in its log file), but when this code is executed

    $prop = $ICE->getProperty("Ice.Default.Router");
    $router = $ICE->stringToProxy($prop)->ice_checkedCast("::Glacier2::Router");
    $session = $router->createSession("user", "password");

    I obtain the following error:

    no Slice definition found for type ::Glacier2::Router in /var/www/masyro/agentes.php on line 15

    I have found a similar example with IcePack, but my example doesn't work by following the same steps. I use Debian etch/sid, Ice 3.1.0, PHP 5, and Apache2.

    Thank you again,
    David.
  • mes
    mes California
    You need to do something like this:
    ice.slice=-I/usr/share/slice /usr/share/slice/Glacier2/Router.ice /var/www/masyro/MASYRO.ice
    
    Take care,
    - Mark