running exec

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

running exec

Post by gurjit »

if i run this in a php script nothing is displayed.

Code: Select all

<?php
echo exec("whoami");
?>
safe_mode is off in php.ini

can i pass the root username and password and run this? I think its an issue with permissions.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: running exec

Post by volka »

please try

Code: Select all

<?php
error_reporting(E_ALL);
ini_set('display_errors', true);
echo 'whoami:', exec('whoami 2>&1');
?>+
Post Reply