0

I'm trying to install PAMI library I installed it via pear:

# pear channel-discover pear.marcelog.name
# pear install marcelog/PAMI

and trying to use example.php

    $pamiClientOptions = array(
        'host' => '127.0.0.1',
        'scheme' => 'tcp://',
        'port' => 9999,
        'username' => 'admin',
        'secret' => 'mysecret',
        'connect_timeout' => 10000,
        'read_timeout' => 10000
    );

    use PAMI\Client\Impl\ClientImpl as PamiClient;
    $pamiClient = new PamiClient($pamiClientOptions);

    // Open the connection
    $pamiClient->open();

    // Close the connection

$pamiClient->close();

when I try to use this script I receive error:

Class 'PAMI\Client\Impl\ClientImpl' not found 

It's first time, I see that classes are included like this (use). I'm using debian Linux also. Please, help.


UPDATE
Also it's installed in /usr/share/php/PAMI/

Sergey Scopin
  • 2,217
  • 9
  • 39
  • 67

1 Answers1

0

Solved. I've found solution in "in_depth explanation" You had to do this after pear installation

require_once '/usr/share/php/PAMI/Autoloader/Autoloader.php';
PAMI\Autoloader\Autoloader::register();

I put this two strings at top of my script and it works now. But it also receives strange

PHP Fatal error:  Class 'Logger' not found in

I solve this by installing log4php:

$ pear channel-discover pear.apache.org/log4php
$ pear install pear.apache.org/log4php/Apache_log4php-2.1.0

And also you should put before first require_once -

require_once '/usr/share/php/log4php/Logger.php';
Sergey Scopin
  • 2,217
  • 9
  • 39
  • 67