Web Hosting Talk







View Full Version : PHP and Shell Command


Omair Haroon
12-29-2001, 04:47 PM
Hello guys,

Would anyone here like to guide me how would I be able to run shell commands through a PHP script. I have compiled PHP as a cgi module too.

For example, can anyone guide me how would I got going restarting apache server.


Would like to thanks for all those who would contribute their time in helping me out.



Salam,
-Omair

The Prohacker
12-29-2001, 04:57 PM
To restart apache, you need to be root, and PHP scripts will either run as the user that uploaded them, or as nobody, it will no have access to do that....

You can run commands to the server via the exec sytanxes (http://www.php.net/manual/en/ref.exec.php) .....

drewnick
12-29-2001, 06:03 PM
And of course you want to be VERY VERY VERY careful. <smile>

Did I mention being VERY careful? With the security risks inherant in Cobalt servers anyway, be very "vigilent" about your security procedures.

£.02 worth
Drew

JTY
01-04-2002, 02:31 AM
What you'll need is a shell program that allows you to run programs as another user. I'm not sure which ones would work on a raq tho...