为了将我的应用程序转换为laravel,我尝试创建一个新的应用程序。我使用网络挂载来访问linux服务器上的文件。没有ssh访问权限。我的机器是Windows。服务器可作为网络挂载访问。在安装驱动器上创建laravel-6应用程序时,我得到了以下错误:
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
In PackageManifest.php line 179:
The R:\path\to\laravel\bootstrap\cache directory must be present and writable.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1在所有的目录中我都能读和写。经过一些测试后,我发现is_writable总是为驱动器上的文件返回false (在Windows上)。这很愚蠢,因为我可以在驱动器上创建和修改文件(包括缓存目录)。我也在cygwin试过。同样的结果。
php fileperms方法返回格式化:40777。所以我想它应该是可读的和可写的。php版本: 7.3.9
如何将我的windows php环境配置为将文件视为可写文件?
发布于 2022-08-11 09:23:29
当您访问网络(smb或samba)文件时,这似乎是php中已知的一个bug。
类似的问题已经被问到了:is_writable returns false for NFS-share, even though it is writable for the user www-data
有关bug:https://bugs.php.net/bug.php?id=68926的更多信息,请阅读以下内容
不幸的是,这个问题的唯一解决方案(据我所知)是编写您自己的定制is_writeable函数,如下所示:
<?php
namespace Same\As\One\You\Use\Them\In;
function is_readable($file)
{
if(file_exists($file) && is_file($file))
{
$f = @fopen($file, 'rb');
if(fclose($f))
{
return true;
}
}
return false;
}
function is_writable($file)
{
$result = false;
if(file_exists($file) && is_file($file))
{
$f = @fopen($file, 'ab');
if(fclose($f))
{
return true;
}
}
return false;
}
?>https://stackoverflow.com/questions/61225949
复制相似问题