Calling python scripts from php

Discussion in 'Python' started by Michael Livingston, Mar 3, 2005.

  1. Hi all,

    I'm currently working on a project to develop an online simulation model of
    the juvenile justice system in Queensland. We've developed the simulation
    model using the python module simPy and currently we're trying to link the
    simulation model to a web interface. Unfortunately, the web interface and
    its interactions with the database have been separately developed in PHP and
    ASP. Rather than rebuilding the web interface using python, we're looking
    for an easy way to call a python script from within PHP. In particular,
    we'd like to have the script called but, as running the model can take some
    time, we'd prefer if the browser didn't have to sit and wait while the
    script was running (instead, we intend to notify the user via email when
    their model has completed). So all we really want to do is start the script
    off and running (it's a simple call to a python method).

    If you're particularly interested in helping me out and if I've not been
    entirely clear, you can go to:

    http://210.49.85.147:8000/justicemodel/login.php

    and log in using the user name: temp and the password: pass, select a model
    and go to the workspace - the button 'run model' is what we want to trigger
    the python script, while all the rest of the website (setting up the model
    scenarios, viewing output etc etc) has been developed in php and asp. Any
    assistance anyone can offer me would be greatly appreciated.

    Thanks a lot,
    Michael
    Michael Livingston, Mar 3, 2005
    #1
    1. Advertising

  2. In article <4226f587$0$6162$>,
    Michael Livingston <> wrote:
    >Hi all,
    >
    >I'm currently working on a project to develop an online simulation model of
    >the juvenile justice system in Queensland. We've developed the simulation
    >model using the python module simPy and currently we're trying to link the
    >simulation model to a web interface. Unfortunately, the web interface and
    >its interactions with the database have been separately developed in PHP and
    >ASP. Rather than rebuilding the web interface using python, we're looking
    >for an easy way to call a python script from within PHP. In particular,
    >we'd like to have the script called but, as running the model can take some
    >time, we'd prefer if the browser didn't have to sit and wait while the
    >script was running (instead, we intend to notify the user via email when
    >their model has completed). So all we really want to do is start the script
    >off and running (it's a simple call to a python method).
    >
    >If you're particularly interested in helping me out and if I've not been
    >entirely clear, you can go to:
    >
    > http://210.49.85.147:8000/justicemodel/login.php
    >
    >and log in using the user name: temp and the password: pass, select a model
    >and go to the workspace - the button 'run model' is what we want to trigger
    >the python script, while all the rest of the website (setting up the model
    >scenarios, viewing output etc etc) has been developed in php and asp. Any
    >assistance anyone can offer me would be greatly appreciated.

    .
    .
    .
    I'm sure there's a satisfactory solution. I'd be happy to work
    with you, even on a professional basis. It might be quite simple
    .... To make any progress, I or anyone helping you through
    comp.lang.python will need to understand clearly your description.
    When you write, " So all we really want to do is start the script
    off and running (it's a simple call to a python method)", do you
    realize that's more of a PHP then Python question? The answer
    is messy (from a Python perspective), but certainly feasible. I
    assume your server is a Win* host; Unix would be easier. Briefly,
    you need to exec("start ...") (or even system("exec ..."), if you
    prefer), and to do so successfully you'll probably need to adjust
    the configuration of your PHP installation.
    Cameron Laird, Mar 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan Danielsson
    Replies:
    8
    Views:
    620
    Mike Meyer
    Jul 22, 2005
  2. Jp Calderone
    Replies:
    0
    Views:
    449
    Jp Calderone
    Jul 21, 2005
  3. davidj411
    Replies:
    0
    Views:
    492
    davidj411
    Jun 27, 2008
  4. Rajive Narain
    Replies:
    0
    Views:
    1,687
    Rajive Narain
    Sep 18, 2009
  5. Bill H

    Flash calling Php calling Perl

    Bill H, Jun 4, 2009, in forum: Perl Misc
    Replies:
    3
    Views:
    248
    Mark Smith
    Jun 4, 2009
Loading...

Share This Page