I am running PHP 5.2.14 on Apache/2.2.16 (Win32) and I have a script to run a shell command, which when tested in the command prompt works well but in browser mode (html), it doesn't.
Scripts:
mybatfile.bat
REM ...
REM process some folder details
REM code which does not work in browser mode but works in cmd mode
C:/somfolder/bin/mysqldump -u abc -pabcdef --result-file="C:/Apache22/somfolder/DBbackup/DBbackup.%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%.sql" --dump-date --log-error="C:/Apache22/somfolder/DBbackup/DBbackup.%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%.log" dbname > dboutputresult.txt
REM process result of savedfile
calltobatfile.php
//process some folder information
$file = file_get_contents($folderroot."/exec/mybatfile.bat");
//var_dump($file);
$strarr = explode("\n", $file);
foreach($strarr as $line){
if(strlen($line)>1){
var_dump("line: ".$line."\n");
$output = shell_exec($line);
print_r($output);
}
}
//process result of savedfile additional information
What can I try next?