laravel 5 打开页面报错

有2个疑问:
1.本地php artisan serve 可以
2.不知道为什么移动服务器之后,会去创建或者读取/目录的文件,所以没有权限,报错
3.是权限目录,也777过目录,但是这里应该不是单纯的权限,因为程序不可能去读/,都是用相对目录的,但是不知道哪里用了这个绝对目录

ErrorException in Filesystem.php line 109:
file_put_contents(/b53e72be8b40e01b5dd6a10f6254791b9c073338.php): failed to open stream: Permission denied

已经尝试过:

php artisan clear-compiled
php artisan optimize      
php artisan cache:clear
阅读 4.3k
4 个回答

找到问题了. 如果没有views目录的话,就会去根目录

Filesystem.php,如果没有传path的话,就会空了...

 public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }

之前迁移过来删掉了整个 storage目录,现在重建的时候忘了重建views目录

  /*
    |--------------------------------------------------------------------------
    | Compiled View Path
    |--------------------------------------------------------------------------
    |
    | This option determines where all the compiled Blade templates will be
    | stored for your application. Typically, this is within the storage
    | directory. However, as usual, you are free to change this value.
    |
    */

    'compiled' => realpath(storage_path('framework/views')),

Permission denied

权限问题

权限不足:

chown -R www-data:www-data /var/www
chmod 777 -R /var/www/html/storage

估计是权限问题,laravel所有的部署问题都可以在这里找到解决方法,选择你自己的服务器版本即可http://bbs.earnp.com/blog?tit...

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进