PHP exec() of bat file returns 0 when ran manually and -1 when ran via ajax -


i'm getting different $return values based on how execute bat file.

when test script have uses exec($command, $output, $return) run bat file running script manually command line 0 $return , can see value in $out expected. when run same script via ajax $return -1 , $out blank array.

i can't find whole lot of info negative return values i'm thinking it's pretty safe saying error - though i'm not sure how more info that.

what reason i'm getting different $return values based on how run bat file?

thanks advice , assistance.

ajax code - using ajaxtime try , see how long requests taking. varying around 550-650 response time:

var ajaxtime = new date().gettime(); getdsize(f, ajaxtime);  function getsize(f, ajaxtime){         $.ajax({             url: "php file handling ajax request",             type: "post",             data: {                 file : encodeuricomponent(f),                 }             })         .done(function(data){             var totaltime = new date().gettime()-ajaxtime;             console.log("ajax time: " + totaltime);             console.log("data: " + data);         })         .fail(function(data){             if ( data.responsecode ){               console.log( data.responsecode );             }             console.log("ajax failure");         });     } 

php code -

    $file = $_post['file'];     echo bat_getsize ($file); [this calls bat_getsize function]  function bat_getsize($file){     exec("getsize \"$file\"",$out, $ret);     return $out[0]; } 

which calls bat code -

@echo off echo %~z1 

thanks!

update correct in understanding using .done() callback prevent ajax request being interrupted next request sent? or failure?


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -