Laravel file_exists(): open_basedir 限制在共享主机中生效
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/50501648/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel file_exists(): open_basedir restriction in effect in shared Host
提问by Amirreza Moradi
Hi everyone we developed project with laravel framework and everythings ok in local and vps server, when we want to move the project to shared host , we just move the project files and clear cache files ans setup database confog in env file, but when refresh the site we face the error:
大家好,我们使用 Laravel 框架开发了项目,并且在本地和 vps 服务器上一切正常,当我们想将项目移动到共享主机时,我们只需移动项目文件并清除缓存文件和 env 文件中的设置数据库配置,但是当刷新我们面临的网站错误:
file_exists(): open_basedir restriction in effect. File(/home/loca/domains/loca.cf/libs/storage/framework/sessions/JPdCM3pG7UDe6fIPXwyxSzfCRJuqCAn8xYDXRW7B) is not within the allowed path(s): (/home/amenc/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php56/lib/php/)
file_exists(): open_basedir 限制生效。文件(/home/loca/domains/loca.cf/libs/storage/framework/sessions/JPdCM3pG7UDe6fIPXwyxSzfCRJuqCAn8xYDXRW7B)不在允许的路径内:(/home/amenc/:/tmp:/var/tmp:/usr /local/lib/php/:/usr/local/php56/lib/php/)
our php version is 7 but the host version is 5.6, is that make problem? we try more than two days to solve that but we cannot please help us to upload the site, thanks alot :)
我们的php版本是7,但是host版本是5.6,是不是make的问题?我们尝试了两天多的时间来解决这个问题,但我们无法帮助我们上传网站,非常感谢:)
采纳答案by Luká? Irsák
Laravel 5.5 requires PHP 7 or above. You need to upgrade your PHP to version 7. If problem still persist after upgrade, try to clear cache using php artisan cache:clear
and make sure that laravel /storage directory is accessible for web server user.
Laravel 5.5 需要 PHP 7 或更高版本。您需要将 PHP 升级到版本 7。如果升级后问题仍然存在,请尝试使用清除缓存php artisan cache:clear
并确保web 服务器用户可以访问 laravel /storage 目录。
回答by Daniel Lee
Php 7 is required, yet also double check all the /storage folders copied up correctly and the permissions are writable for laravel to write to those folders
Php 7 是必需的,但还要仔细检查所有 /storage 文件夹是否正确复制,并且 Laravel 可以写入权限以写入这些文件夹