run a script from php..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    run a script from php..

    Hi,

    I would like to run a custom script on a linux box via a button on a php
    page (php webpage hosted on the same linux box).

    Is this possible? If so , can you give me a pointer in the right direction?

    thanks
    James


  • Jason Dumler

    #2
    Re: run a script from php..

    James,

    Do you mean run a custom script inside the browser's environment as the
    browser's user rather than the web server's environment as the web
    server's user?

    Or...

    Do you mean click a button in the browser window, but don't post that
    page to the web server, but have the web server run a script anyway?

    If it is the second one, you can do something with frames. With a
    hidden iframe on your web page, you can use javascript to build a form
    in that iframe, and then cause that form to post to the server. Then
    the server runs the posted script.

    If it is the first one, I don't think you can. Well, you could do this:
    Configure your browser to run .phpsc files using the commandline php.
    Write your PHP script, make sure it works, and rename it with a .phpsc
    extension. When you click on the button, use javascript to fetch that
    file. When the browser gets the file, it'll ask you what to do with the
    ..phpsc file, run it or save it. You can then run the file. You can't
    use a .php extension because the server will parse the .php file and run
    it, so we make up a .phpsc extension. This is obviously a single user
    solution, but it will execute the script.

    You could probably do something with a Java applet. If you're using
    Mozilla, you could write some sort of Mozilla extension that would do
    what you're looking for.

    Jason

    James wrote:[color=blue]
    > Hi,
    >
    > I would like to run a custom script on a linux box via a button on a php
    > page (php webpage hosted on the same linux box).
    >
    > Is this possible? If so , can you give me a pointer in the right direction?
    >
    > thanks
    > James
    >
    >[/color]

    Comment

    Working...