Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Exec() wont run program
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 1st July 11:49
csufsurfer
External User
 
Posts: 1
Default Exec() wont run program



I want to start up a program through a php page. For example, gedit.

I found that the user is apache by running this:
- passthru('whoami');

since apache might not have access to run a certain command, I'll use
sudo. I edited the sudoers file in /etc/sudoers and underneath the
line: # User privilege specification, I added:
apache ALL=(ALL) NOPASSWD: ALL

which would give apache access to run any command without a password.
So in my php file the line looks like this:

exec("sudo gedit");

And it doesn't do anything. Any suggestions.
  Reply With Quote


 


2 1st July 11:49
php-general
External User
 
Posts: 1
Default Exec() wont run program



What is gedit? it looks like the gnu text editor command. most X
applications
wont run from the webserver in most cases.


echo shell_exec("sudo gedit");

might give some answers,

Curt.
  Reply With Quote


 


3 1st July 19:46
csufsurfer
External User
 
Posts: 1
Default Exec() wont run program


gedit is a simple text editor - I think it stands for Gnome Edit


Tried echo shell_exec("sudo gedit"); and still application doesn't run
and no output is echoed to the web page.

You said most X applications won't run from the webserver. Is there a
way to get around that? Because I tried calling a custom shell script
which opened those programs for me, which also didn't work. I've
created a few applications in Kylix and I want to start them through a
web browser using PHP.
  Reply With Quote
4 2nd July 11:54
csufsurfer
External User
 
Posts: 1
Default Exec() wont run program


Curt, I'm trying to understand why most X applications wont run from the
webserver in most cases. If nothing else, you should at least be able
to run a shell script from php and have that execute other X
applications to run on the webserver. To make things clear, the client
initiates the execution of the applications (through php of course), but
the applications are supposed to run on the webserver.

Is there more information available somewhere that explains why most X
applications wont run from the webserver? Thanks.

Steve
  Reply With Quote
Reply


Thread Tools
Display Modes




666