How to debug Laravel Site show HTTP ERROR 500?

戏子无情 提交于 2020-01-03 05:19:11

问题


I'm on Laravel 5.7, and my app loading fine on my local Mac OSX.

But on my production Ubuntu Server, I kept getting 500


permissions

I've already chmod R 777 storage/ bootstrap/ vendor/


.env

I also check my .env file, everything seem to be in place proper configured.


nginx

I checked in cd /var/log/nginx/ I see nothing there.


laravel

I checked /home/forge/bheng/storage/logs - nothing there also.


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"
    }
}

How would one go about debugging this further?


回答1:


Check if the php version is correct, to know PHP version your Apache server is using use phpinfo(),php version check but you might get a different version in php -v. if that is the issue use

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

To switch php versions and then goto bootstrap/cache folder and clear the folder.




回答2:


Your laravel.log file has only root lavel write permission, however it seems your webserver using www-data as a group and maybe a user too. You can change group and owner of laravel.log file.

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

after this it will start logging.

For file permission in Laravel 5 you can check this How to set up File Permissions for Laravel 5 (and others)



来源:https://stackoverflow.com/questions/54449639/how-to-debug-laravel-site-show-http-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!