我的VPS 2012 R2配置了一个plesk和一个域名,当我尝试在txt文件中创建和写入文本时出现错误,我尝试了所有可能的方法来解决它无法解决的问题
我的PHP
<?php
$myfile = fopen("E:\Log\newfile.txt", "w") or die("Unable to open file! " . var_export(error_get_last(), true));
$txt = "Mickey Mouse\n";
fwrite($myfile, $txt);
$txt = "Minnie Mouse\n";
fwrite($myfile, $txt);
fclose($myfile);
?>错误:
PHP Warning: fopen(): open_basedir restriction in effect. File(E:\Log
ewfile.txt) is not within the allowed path(s): (C:/Inetpub/vhosts/test.in\;C:\Windows\Temp\) in C:\Inetpub\vhosts\test.in\httpdocs\Test.php on line 2
PHP Warning: fopen(E:\Log
ewfile.txt): failed to open stream: Operation not permitted in C:\Inetpub\vhosts\test.in\httpdocs\Test.php on line 2发布于 2016-03-09 23:00:44
除了open_basedir之外,您的PHP脚本在特定的系统用户下执行,该用户仅在的C:/Inetpub/vhosts/test.in中具有权限
同时在“托管设置”中检查“附加写入/修改权限”:

发布于 2016-03-08 21:43:09
您已经启用了open_basedir,这限制了允许其读写文件的范围(以防止可能读写文件系统上的任何文件的潜在攻击或bug)。删除设置或写入配置的基本目录中的文件。
https://stackoverflow.com/questions/35868983
复制相似问题