• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 646
  • Last Modified:

shell_exec fails - mehtinks it is permission related...

I am trying to use PHP to reload the extensions in an Asterisk installation. I keep getting this error:

Unable to connect to remote asterisk (does /var/run/asterisk.ctl exist?) when I run the script by visiting the URL; however, if I run the script from the command line, it runs just fine (works perfect, actually).

I think it is permissions related. Does anyone have any ideas?

<php
        $output = shell_exec('asterisk -rx"extensions reload"');
        echo $output;
?>
0
DrDamnit
Asked:
DrDamnit
1 Solution
 
ahoffmannCommented:
use full path for asterisk, there might also be a configuration file probably used from the current user's home directory
0
 
DrDamnitAuthor Commented:
Figured out the problem. PHP runs as nobody and only root has access to asterisk. I ended up using phpagi to restart the asterisk service.
0
 
Vee_ModCommented:
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now