mardi 23 août 2016

Run scripts in php

I am running a python script through my php. It works fine on console but returns null when I run it on browser.I even tried writing output to a file, but it doesn't return anything. The php code is:

<?php

$y = "python Code.py";

$output = shell_exec($y);

if($output!=null){
echo $output;
}
else {
echo "No output";
}




$myfile = fopen("test.txt", "w") or die("Unable to open file!");

fwrite($myfile, $output);

fclose($myfile);


?>




Aucun commentaire:

Enregistrer un commentaire