run a bash script from apache??

Discussion in 'OT Technology' started by monster_rancher, Apr 28, 2005.

  1. monster_rancher

    monster_rancher OT Supporter

    Joined:
    Apr 5, 2002
    Messages:
    4,184
    Likes Received:
    0
    hi, i want to run a bash script from apache...
    can perl or php triger a bash script?... i have no idea...

    thanks.
     
  2. ProFX

    ProFX New Member

    Joined:
    Apr 10, 2005
    Messages:
    266
    Likes Received:
    0
    Location:
    Melbourne, AU.
    Yes, I believe both can. Not sure how :) might have a look into that later.
     
  3. ProFX

    ProFX New Member

    Joined:
    Apr 10, 2005
    Messages:
    266
    Likes Received:
    0
    Location:
    Melbourne, AU.
    OK.. write your script. Make it executable. Then read this:

    http://au.php.net/manual/en/function.exec.php

    That should get you started.
     
  4. ShapeShifterz

    ShapeShifterz Longtime Lurker

    Joined:
    Mar 15, 2000
    Messages:
    183
    Likes Received:
    0
    Location:
    Bay Area, CA
    cgi allows this. cgi doesn't care what language you're using.
     
  5. monster_rancher

    monster_rancher OT Supporter

    Joined:
    Apr 5, 2002
    Messages:
    4,184
    Likes Received:
    0
    so more or less perl?
     
  6. ShapeShifterz

    ShapeShifterz Longtime Lurker

    Joined:
    Mar 15, 2000
    Messages:
    183
    Likes Received:
    0
    Location:
    Bay Area, CA
    I'll try to explain in simple terms. Not sure about your skill level so pardon me if i'm insulting your intelligence here..

    Apache is more or less a file server. In most cases, it transfers .html files to your browser. If cgi is enabled, instead of serving your perl, bash, python...etc file, it will run it on the server first, and then serve you that script's output instead. So it doesn't matter what language you write it in, as long as the output is in HTML, and as long as the server has the right interpreter installed.
     

Share This Page