1

我有这个 PHP 代码:

ini_set('display_errors', 1);
ob_start();
passthru('/usr/bin/python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt');
$output = ob_get_clean(); 
echo $output;


$message = exec("/usr/bin/python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt");
print_r($message);

$command = shell_exec('python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt');
echo $command;

$output=shell_exec('python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt');
echo "<pre>$output</pre>";


$command = escapeshellcmd('python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt');
$output = shell_exec($command);
echo $output;

exec('sudo -u www-data python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt');

system("cd /usr/lib/cgi-bin && sudo python3 /home/domains/mydomain.pl/public_html/a.py /home/domains/mydomain.pl/public_html/code2.txt");

我希望 PHP: 1. 启动 a.py 脚本 2. 返回控制台将从 a.py 显示的结果并将其显示在 Web 浏览器中。

目前,什么都没有出现。我没有任何错误消息或警告。

有谁知道上面的代码有什么问题?

我的服务器允许使用控制台运行脚本

4

0 回答 0