【问题标题】:Error 500 after installing Laravel 5.3安装 Laravel 5.3 后出现错误 500
【发布时间】:2018-04-25 11:57:32
【问题描述】:

我有一个在我的本地主机(wampserver)上运行良好的 Laravel 项目(5.3 版)。

现在我想在我网站的子域上运行这个项目。我有 ssh root 访问权限和 vps 用户访问权限(不是管理员 - 使用 Directadmin - PHP 版本 5.4)。

我将项目文件上传到我的服务器,但是当我尝试查看项目结果时,它给了我一个 500 错误。

我试图更改“存储”文件夹权限,所以我阅读了this answer,但是当我运行“chchon”ssh 命令时,我收到如下错误:

can't apply partial context to unlabeled file ...

另外,我已经用 4.2 版测试了 Laravel,它运行良好。

有没有男生有想法??谢谢

【问题讨论】:

  • storage/log/laravel.log 文件中有什么吗?
  • @usrNotFound 我没有看到任何新内容。我认为 Laravel 没有运行,所以没有新的日志

标签: php laravel ssh


【解决方案1】:

尝试所有这些

// first delete the vendor folder inside your project root, then run
 composer install     

// laravel generates log file there
 sudo chmod -R 777 storage/logs

// laravel cache the files here
 sudo chmod -R 777 bootstrap/cache 

// vendor folder, where laravel saves their dependencies
 sudo chmod -R 777 storage/ vendor/

// generate a application key
 php artisan key:generate

这可能会有所帮助:)

【讨论】:

  • 感谢您的帮助。当我运行“php artisan key:generate”时,出现以下错误:PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/samt/domains/WEBSITE/public_html/SUB/artisan on line 31 另外,当我运行“sudo chmod ..”命令时,出现以下错误:chmod: missing operand after bootstrap/cache' `
  • 当我尝试安装作曲家时,我得到一些这样的错误:PHP Warning: putenv() has been disabled ... Problem 3 - Installation request for laravel/framework v5.3.31 -> satisfiable by larav el/framework[v5.3.31]. 你认为问题是服务器 php 版本吗?正如我之前所说,Laravel 4.2 运行良好!
  • 是的。我想是的,composer.json 中的一些包需要一些额外的扩展或其他东西。请参阅此链接以获取 put env laravel.io/forum/04-16-2015-disabled-function-putenv
【解决方案2】:

如果您没有启用 SELinux,您可以简单地使用 chmod 设置权限,或者使用 chown 将存储目录的所有者设置为 Web 服务器的用户。 (可能是 www-data)
尝试在项目目录下运行sudo chown -R www-data storage

【讨论】:

    猜你喜欢
    • 2017-09-01
    • 2017-01-01
    • 2017-01-22
    • 2017-11-15
    • 2021-02-09
    • 2016-03-31
    • 1970-01-01
    • 2016-12-01
    • 1970-01-01
    相关资源
    最近更新 更多