hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : exec or something like it
Reply

Forum Jump

exec or something like it

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-03-2002, 11:12 AM
marianna marianna is offline
New Member
 
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



Sponsored Links
  #2  
Old 09-04-2002, 07:24 AM
gaouzief gaouzief is offline
New Member
 
Join Date: Sep 2002
Posts: 4
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  
Old 09-04-2002, 09:54 AM
marianna marianna is offline
New Member
 
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

Sponsored Links
  #4  
Old 09-04-2002, 10:20 AM
gaouzief gaouzief is offline
New Member
 
Join Date: Sep 2002
Posts: 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  
Old 09-04-2002, 11:34 AM
marianna marianna is offline
New Member
 
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  
Old 09-04-2002, 05:07 PM
wakkow wakkow is offline
WHT Addict
 
Join Date: Aug 2002
Location: Davis, CA
Posts: 169
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  
Old 09-04-2002, 07:11 PM
benoire benoire is offline
Registered User
 
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  
Old 09-08-2002, 03:39 PM
marianna marianna is offline
New Member
 
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!

Reply

Related posts from TheWhir.com
Title Type Date Posted


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?