0

我正在尝试从浏览器执行一些 shell 命令。但是每当我这样做时,我都会收到“php 未被识别为外部或内部命令”错误,而它在终端中运行良好。我试着在网上寻找它,发现了一些与“www-data”用户相关的东西,我无法理解。你能帮我弄清楚下面给出的代码可能是什么问题吗?

<?php

shell_exec("php -r \"copy('https://getcomposer.org/installer', 'composer-setup.php');\"");
        shell_exec("php composer-setup.php --install-dir=" . $this->binPath . " --filename=composer");
        shell_exec("php -r \"unlink('composer-setup.php');\"");

我期待 shell_exec 命令在所需位置为我下载和安装作曲家。

4

0 回答 0