AGI Scrip Error Failed verbose "Failed to execute '

hello,
I am working with AGI, I have a basic script for testing purposes here it is

[color=green]#!/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(); ?>[/color]

and I am calling this in my dialplan extension as

[color=blue]exten => 5,1,AGI(input.php); the file name is input.php
exten => 5,n,Goto(from-zaptel,s,1)[/color]

I placed input.php file into var/lib/asterisk/agi-bin/
but the asterisk is unable to locate the file

[color=red]AGI Rx << verbose “Failed to execute ‘/var/lib/asterisk/agi-bin/input.php’: No such file or directory” 2
== input.php: Failed to execute ‘/var/lib/asterisk/agi-bin/input.php’: No such file or directory
AGI Tx >> 200 result=1
– Executing [5@from-zaptel:2] Goto(“Zap/1-1”, “from-zaptel|s|1”) in new stack
– Goto (from-zaptel,s,1)
– Executing [s@from-zaptel:1] Answer(“Zap/1-1”, “”) in new stack
– Executing [s@from-zaptel:2] Wait(“Zap/1-1”, “1”) in new stack[/color]

any help or suggestion will be highly appreciated.
best regards
Numan

imho, there’re three posibilities:

  • asterisk user doesnt have permission to execute the file
  • php is not installed (or the path is incorrect)
  • the path to phpagi.php is incorrect

for example, execute chmod 777 /path/to/your/phpagi.php and check again
if it helps, you’ll be able to

‘chown asterisk:asterisk /path/to/your/phpagi.php; chmod 744 /path/to/your/phpagi.php’
(i’m not sure about the user and group names)

cheers

the user access level for the agi directory should be root user or asterisk user?

I have most folders chowned by default to asterisk:asterisk on my ubuntu

I have changed the chmod +x /var/lib/asterisk/agi-bin/input.php

I dont understand why it is keep me telling that permission denied.
:imp:

try su asterisk and try to start your php