如何调试Laravel Site show HTTP ERROR 500?

时间:2019-01-30 21:14:58

标签: php laravel nginx laravel-5 laravel-5.7

我使用的是Laravel 5.7,我的应用程序可以在本地Mac OSX上正常加载。

但是在我的生产Ubuntu Server上,我不断获得500


权限

我已经chmod R 777 storage/ bootstrap/ vendor/


.env

我还检查了.env文件,所有内容似乎都已正确配置。


nginx

我在cd /var/log/nginx/处签到,什么都没看到。


laravel

我检查了/home/forge/bheng/storage/logs-也没有。


composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.7.*",
        "intervention/image": "^2.3",
        "laravelcollective/remote": "5.7.*",
        "doctrine/dbal": "^2.3",
        "league/flysystem-sftp": "^1.0",
        "laravelcollective/html": "^5.4.0",
        "phpseclib/phpseclib": "~2.0",
        "htmlmin/htmlmin": "^5.0",
        "league/flysystem-aws-s3-v3": "~1.0",
        "vinkla/instagram": "^8.0",
        "php-http/message": "^1.6",
        "php-http/guzzle6-adapter": "^1.1"
    },
    "require-dev": {
        "phpunit/phpunit": "~7.0",
        "phpspec/phpspec": "~5.0",
        "symfony/dom-crawler": "~3.1",
        "symfony/css-selector": "~3.1",
        "filp/whoops" : "~2.0"
    },
    "autoload": {
        "classmap": [ "database" ],

        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
        ]
    },
    "scripts": {
        "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
        ],
        "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize"
        ],
        "post-create-project-cmd": [
        "php -r \"copy('.env.example', '.env');\"",
        "php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

如何进一步调试呢?

2 个答案:

答案 0 :(得分:0)

您的laravel.log文件仅具有root个lavel写入权限,但是看来您的网络服务器使用www-data作为组,也可能是用户。可以更改组和laravel.log文件的所有者。

chown  www-data:www-data /home/forge/bheng/storage/logs/laravel.log

在此之后,将开始记录。

有关文件权限在Laravel 5可以检查此How to set up File Permissions for Laravel 5 (and others)

答案 1 :(得分:0)

检查php版本是否正确,以了解您的Apache服务器正在使用的PHP版本,请使用phpinfo(),php version check,但是您可能会在php -v中获得其他版本。如果是问题,请使用

    $ sudo a2dismod php5.6
    $ sudo a2enmod php7.1
    $ sudo service apache2 restart

要切换php版本,然后转到bootstrap / cache文件夹并清除该文件夹。