Facebook   Twitter    e-mail newsletter    YouTube    RSS Feed    Android App    iPhone and iPad App     BlackBerry App    


Results 1 to 7 of 7

Thread: shell script and php

  1. #1

    Default shell script and php

    I have a small problem and i am not to sure what i am doing wrong, I have a
    Small shell script that checks the connected peers in asterisk for e.g

    #!/bin/sh
    asterisk –rx “iax2 show peers”

    Then the code I use in my php is very simple passthru command.

    <?
    passthru (“./peers.sh”)
    ?>

    Or I have tried

    <?
    passthru (“/var/www/peers.sh”)
    ?>

    This however also does not work…. Not to sure what I can try
    I can run the script successfully from the CLI … any suggestions ?

  2. #2

    Default

    Did the php script throw you an error?

  3. #3

    Default

    nope no error just wont display anything ...

  4. #4

    Default

    Are you running this PHP script from a webserver? If yes check what user the webserver is running as and if they have a shell defined and sufficient permissions.

  5. #5
    Grandmaster
    Join Date
    Mar 2005
    Location
    Johannesburg
    Posts
    1,905

    Default

    Do not think pasthru is the right command.

    What does exec() do for you? http://www.php.net/manual/en/function.exec.php

  6. #6

    Default

    i have tried exec() and system() such a small issue bleh ....

  7. #7

    Default

    try change

    Quote Originally Posted by flenters View Post
    #!/bin/sh
    asterisk –rx “iax2 show peers”


    to
    #!/bin/sh
    /usr/sbin/asterisk –rx “iax2 show peers”

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •