我在Windows Server上运行Xampp; Apache作为具有本地帐户的服务运行.在此服务器上,网络共享作为X:安装,具有特定凭据.
我想访问位于X上的文件:并运行以下代码
<?php
echo shell_exec("whoami");
fopen('X:\\text.txt',"r");
?>
Run Code Online (Sandbox Code Playgroud)
得到
theservername\thelocaluser
Warning: fopen(X:\text.txt) [function.fopen]: failed to open stream: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我试图运行Apache,而不是作为服务,但直接通过启动httpd.exe ...并且代码工作.
我无法看到导致服务和应用程序之间的差异以及如何使其工作的原因.
我可以使用fopen打开本地文件,但无法在不同的计算机上通过网络打开文件.我可以映射驱动器并查看文件但无法使用fopen打开它们.