Search code examples
phplinuxasteriskpermission-deniedagi

Asterisk Failed to execute '/usr/share/asterisk/agi-bin/call_handle.php': Permission denied


Server: Ubunto

Asterisk Version: 11.x

Directory: /usr/share/asterisk/agi-bin/ File: call_handle.php

Directory Permission: 755 root root File Permission: 755 root root

asterisk.conf

astagidir => /usr/share/asterisk/agi-bin

extensions.conf

same  => n,AGI(call_handle.php)

When I dial any number this AGI PHP Script is run. But, It will give me this message in asterisk console.

Asterisk Failed to execute '/usr/share/asterisk/agi-bin/call_handle.php': Permission denied

I am not sure why this message is comes up. It has execute permission with ROOT user


Solution

  • I got answer myself: Set PHP Envirement in my php script and it will run by asterisk.

    I have set following in my php file at first line:

    #!/usr/bin/env php
    

    Reff: PHPAGI: Exec format error