bash - function shell_exec() php works with shell but not with interface
Get the solution ↓↓↓I am doing a script in php who execute a script bash(.sh).
The script works in shell but not with the interface.
Script:
<?php
echo 'test'."\n"."<BR/>";
$old_path = getcwd();
$cmd = chdir('/db/ITSA/BILLING_GENERATOR/');
echo getcwd()."\n"."<BR/>";
$output = shell_exec("./test.sh");
if($output === null){
var_dump($output2);
}else{
echo 'Pas de sortie!'.'<BR/>';
};
echo $output;
echo '<BR/>';
echo exec('whoami');
when I run php script.php on the server => output ok
when I run the script in the application have not the output with the shell_exec function.
But all other works fine.
Has someone had ever this issue. Thank you for your help.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: constant expression contains invalid operations
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.