PHPAGI how to install

i downloaded phpagi-2.14

and extracted it to a folder.

Now I have no idea what to do…im told im supposed to:
“add that location to your php include_path”

Im not sure where “location” is

? this is on gentoo if that matters

thanks

Let’s say you extracted the phpagi archive in “/var/lib/asterisk/agi-bin”, you should set the php include path to somethinkg like the following:

set_include_path("/var/lib/asterisk/agi-bin".PATH_SEPARATOR.get_include_path());

Let me say this is not needed when you put the phpagi files and your php agi script in the same directory, so if you put both in “/var/lib/asterisk/agi-bin” just include the php agi files in your script with a command like this:

require('phpagi.php');

Cheers.

Marco Bruni

ok i moved the archive to:
/var/lib/asterisk/agi-bin/phpagi-2.14

in /etc/php/cli-php5/php.ini
and
/etc/php/apache2-php5/php.ini (wasnt sure which to do so i did both)
it had:

include_path = “.:/usr/share/php5:/usr/share/php”

i changed it to:

include_path = “.:/usr/share/php5:/usr/share/php:/var/lib/asterisk/agi-bin/phpagi-2.14”

is that correct?

then restart apache:
/etc/init.d/apache2 restart

Should be correct.

Cheers.

Marco Bruni

I have another problem. I have install phpagi on the platform to my hosting. When I start any program which in exemple, it turns out an error, specifies that in phpagi.php on the line 193 there is a fatal error – probably a problem with circle.

danaeco.ru/phpagi/input.php
Fatal error: Maximum execution time of 10 seconds exceeded in/home/danatclo2/data/www/danaeco.ru/phpagi/phpagi.php on line 193

Here link on
1)phpagi.php danaeco.ru/phpagi/phpagi_php.txt

2)phpagi.conf danaeco.ru/phpagi/phpagi_conf.txt

3)input.php danaeco.ru/phpagi/input_php.txt

please tell, what is false

ps: i speak and write english no good

The error is clear, you php script takes too much time to run and the limit, in the php.ini file, is set to 10 seconds, so you should ask your provider how to change this setting or make your script run faster.

Cheers.

Marco Bruni

i changed set_time_limit(30); thesame resultat
Fatal error: Maximum execution time of 30 seconds exceeded in /home/danatclo2/data/www/danaeco.ru/phpagi/phpagi.php on line 192.

#!/usr/local/bin/php -q

<?php set_time_limit(30); require('phpagi.php'); $agi = new AGI(); $agi->answer(); $cid = $agi->parse_callerid(); $agi->text2wav("Hello, {$cid['name']}. Let's enter some text."); $text = $agi->text_input('UPPERCASE'); $agi->text2wav("You entered $text"); $agi->text2wav('Goodbye'); $agi->hangup(); ?>

Maybe problem which cycle or configuration(setting), because on the line where fatal error in phpagi.php, we have this cycle
// read the request
$str = is_null($this->socket) ? fgets($this->in) : socket_read($this->socket, 4096, PHP_NORMAL_READ);
while($str != “\n”)
{
$this->request[substr($str, 0, strpos($str, ‘:’))] = trim(substr($str, strpos($str, ‘:’) + 1));
$str = is_null($this->socket) ? fgets($this->in) : socket_read($this->socket, 4096, PHP_NORMAL_READ);
}

//

Were you able to solve this ?

I get exactly the same error. The loop goes into endless execution. No matter what time you set, it is going to keep on executing? What could be wrong here ?

// read the request
$str = fgets($this->in);

while($str != “\n”)
{ $this->request[substr($str, 0, strpos($str, ‘:’))] = trim(substr($str, strpos($str, ‘:’) + 1));
$str = fgets($this->in); }