The Xamp environment platform on Ubuntu. When using PHP's shell_exec to execute shell scripts, only partial commands can be executed, or only echo commands can be executed, such as cat, more, and so on, without any return information, such as:
echo "a"
Cat A.txt
More B.txt
echo "B"
The result is: AB, the Middle 2 command is not executed, there is no feedback information, why?
Reply to discussion (solution)
The local execution of the shell script is successful, but using PHP will not be able to execute the
Someone's not there, no one's not there.
Someone's not there.
Permissions issues.
chmod 0777 A.txt Look
$ ll A.txt
$ ll B.txt
Give it a try
The echo above you should not be the echo of the Linux command, it should be the echo of PHP.
$results = ' cat a.txt '; or $results = Shell_exec (' Cat a.txt ');
Echo $results try it.
The problem is done.
1. Path problem, determine the working directory
2. Permissions issues, the relationship between daemon and users should be clear.
Hope to let everyone learn from
a.sh
#!/bin/sh
echo ' Hello World ' >1.txt
/usr/bin/unoconv-f Pdf/mnt/www/test/test.txt
index.php
EXEC ("/usr/bin/a.sh", $status);
Why not generate PDF files.