Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2002
    Location
    TX
    Posts
    4

    Question exec or something like it

    hi

    what I need to do is from a PHP script, spawn a GUI program (not in PHP). exec does not seem to work for that and I'm not sure how to aproach this. It's probably very simple. Could someone please help?

    TIA

    marianna

  2. #2

    try shell_exec

    http://www.php.net/manual/en/function.shell-exec.php

    this should work add & at the end of the command not to get the output sent back to the script

    ___________________________________________________
    Hassan El Forkani
    Founder And Maintainer of :
    http://www.WarmAfrica.com EveryOne's Africa
    Freelance IT Consultant / Web Applications Developer.
    Email: hassan@warmafrica.com
    Tel : 0021671880014
    ___________________________________________________

  3. #3
    Join Date
    Sep 2002
    Location
    TX
    Posts
    4
    this does not work either
    i think this might be a special case because the program i wish to start up is a gui
    this is driving me crazy

  4. #4

    need details

    what is the platform you are working on ? (OS, WebServer...)
    also, could you post the code, so i can get a better idea.

  5. #5
    Join Date
    Sep 2002
    Location
    TX
    Posts
    4
    I'm on a Sun system
    Solaris environment
    Apache web server

    right now, I'm just trying to get the test script working. something like this:


    Hi!

    <?

    //system( "/homes/mgurtova/public_html/DL/mikehup/mikehup /usr/fdlib/bin/cvsgui
    &" );
    //shell_exec( "/usr/fdlib/bin/cvsgui &" );
    exec( "/usr/openwin/bin/xterm -e /usr/local/gnu/bin/ls" )

    ?>

    Done!



    The "Hi" and "Done" both print, but an xterm never opens
    same with shell_exec and system

    the goal of my program will not be to open an xterm, of course, but this is just for testing

  6. #6
    Join Date
    Aug 2002
    Location
    Davis, CA
    Posts
    168
    Your X server probably isn't allowing the script to display because its run by your web server user.. This is to prevent random people from loading programs into your X. Look at the 'xhost' command or xauth (?? not sure if thats right or not) to allow this..

    You can test it by logging in as a different user and try running an graphical program.. It'll probably say something like this:

    Xlib: connection to ":0.0" refused by server
    Xlib: Client is not authorized to connect to Server
    Error: Can't open display: :0.0

    Also, I don't usually run scripts from php, but have you tried the back-tick for run a command? back-tick meaning ` (not an apostrophe, a `). For example:

    echo `ls -al`;

  7. #7
    Join Date
    Jul 2001
    Location
    Coventry, England
    Posts
    130
    Just as a side note, I'm sure this doesn't really need saying but when executing system commands, make sure there's no holes for users to execute anything they want etc!

  8. #8
    Join Date
    Sep 2002
    Location
    TX
    Posts
    4
    after wakkow's post, I realized I was trying to do something very wrong and suddenly felt much shame!

    the solution, if anyone is interested to know: i need to write a plugin

    thank you all for your time and comments and help!

  9. Newsletters

    Subscribe Now & Get The WHT Quick Start Guide!

Posting Permissions

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