I am trying to execute a exec
command, and I am having problems. When I run the following code, it doesn't work when I run it through the browser. but if I take the output of $str
copy and paste it into a terminal it works just fine. What would be causing this and how can I fix it? Currently I am running on localhost
.
$php_location = "/usr/bin/php";
$data = str_replace("\"", "\\\"", json_encode($_POST));
$cwd = __DIR__;
shell_exec($str = "$php_locataion $cwd/phpExcel.php \"$data\" > /home/ryannaddy/Desktop/phpExcel.txt &");
echo $str;
Here is the file shell_exec
is calling:
<?php
set_time_limit(0);
$args = $argv[1];
$data = json_decode(str_replace("\\\"", "\"", $args), true);
echo "hello!";