I've no idea what is happening. I can run any other shell command through the exec()
command and it works fine. It's clearly something to do with permissions somewhere, but I'm unsure what. I've tried this on many different servers and some of them work fine and some don't. All were running CentOS. Safe mode is always off.
This is the code I'm trying to get to work:
<?php
error_reporting(E_ALL);
if( ini_get('safe_mode') ){
echo "safe mode is on";
}else{
echo "safe mode is not on";
}
echo "\n\n";
echo "Start Server.....\n";
//exec("screen -clean", $err, $err1);
//exec("mkdir /var/test/tewst/");
exec("screen -dms test1 mkdir /var/test/test1/", $err, $err1);
print_r($err);
echo "\n" . $err1;
echo "\nCommands sent...";
?>
All thats returned is this:
safe mode is not on
Start Server.....
Array
(
[0] => Cannot make directory '/var/run/screen': File exists
)
1
Commands sent...
Can anyone please shed some light on this at all?