0

我有一个服务器和客户端。服务器有一个 php 文件。这里是:

$postdata = $_FILES['request'];
$reqContent= file_get_contents($postdata['tmp_name']);
shell_exec("echo ".$reqContent." > request.txt");

我使用以下命令将文件从客户端发送到服务器:

curl -i -F "request=@example.txt" <server_url>

但是无法创建输出文件(request.txt)。我该如何解决这个问题?

4

1 回答 1

1

Check your webserver error logs to verify that your not getting an error like 'permission denied' when you test that.

Also you might try shell_exec('pwd') and a shell_exec('whoami') and check the permissions on that directory to verify that the webserver user that is executing the command has permission to write there.

于 2013-11-12T18:36:53.947 回答