PAMI无法找到课程

时间:2015-10-06 06:39:01

标签: php debian asterisk asteriskami

我试图安装PAMI library 我通过pear安装它:

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

并尝试使用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();

当我尝试使用此脚本时收到错误:

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

这是第一次,我看到类包括这样(使用)。 我也使用debian Linux。请帮忙。


更新
它也安装在/ usr / share / php / PAMI /

1 个答案:

答案 0 :(得分: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';