phpnode.jslaravelwebpacksass

I need to Migrate Laravel project from PRODUCTION to Development (localhost)


I have task to implement new features in an old working laravel project. The problem is there is there is no technical support who can tell me how to run it. No documentation or readme. I've got little experience with Laravel so here what I did. I downloaded the whole project include .env file with FTP and placed it in XAMPP htdocs, started apache and mysql. I run npm install, composer install, I imported the DB in localhost/phpmyadmin I executed php artisan migrate. Then php artisan db:seed (which took too long 8-10 min while db is 16mb) but without error. When I start the server I got message Laravel development server started: http://127.0.0.1:8000 but always the error is: Whoops, looks like something went wrong. In the console Failed to load resource: the server responded with a status of 500 (Internal Server Error) I guess can't create connection with the DB. Also when I tried npm install I got many errors but I managed to fix them using older version of Node.

Please help me to run the project.

Tech. info
Laravel Framework 5.4.36
Node version: 12.12.12
PHP version: 7.3.0

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "dimsav/laravel-translatable": "7.*",
        "geoip2/geoip2": "~2.0",
        "intervention/image": "^2.4",
        "laravel/framework": "5.4.*",
        "laravel/tinker": "~1.0",
        "laravelcollective/html": "^5.2.0",
        "maatwebsite/excel": "~2.1.0",
        "matthiasmullie/minify": "^1.3",
        "mockery/mockery": "0.9.*",
        "torann/geoip": "^1.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.7"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        },
        "files": [
            "app/Http/Helpers.php"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "scripts": {
        "post-root-package-install": [
            "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ],
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize"
        ],
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan package:discover"
    ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true
    }
}

When I try to open http://127.0.0.1:8000/ I still get "Whoops, looks like something went wrong." I enabled debug mode cleared cache and I got these errors. What cause them? The project come directly from working production.

Whoops, looks like something went wrong. And in DEBUG mode these errors

    (2/2) ErrorException
Undefined index: 127.0.0.1 (View: D:\DEV\XAMPP\htdocs\BeShared\resources\views\front\home_2023.blade.php)

in d3187463eae345eb4dbf0390f4d742b104703265.php line 27
at CompilerEngine->handleViewException(object(ErrorException), 1)
in PhpEngine.php line 44
at PhpEngine->evaluatePath('D:\\DEV\\XAMPP\\htdocs\\BeShared\\storage\\framework\\views/d3187463eae345eb4dbf0390f4d742b104703265.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'canonical' => 'http://127.0.0.1:8000', 'services' => object(Collection), 'projects' => object(Collection), 'news' => object(Collection), 'current_page' => 'index', 'current_subpage' => 'home', 'request' => object(Request), 'admin' => null, 'pages_header' => object(Collection), 'pages_footer' => object(Collection), 'seo_og_type' => 'article', 'seo_title' => 'Full Service Digital Agency | BeShared', 'seo_description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'social_image' => 'http://127.0.0.1:8000/img/logo-social.jpg', 'footer_logos' => object(Collection), 'career_positions' => object(Collection), 'all_services' => object(Collection), 'cache_buster' => '20200411', 'currentDomain' => array('lang' => 'en', 'phone' => '+39 320 294 8061', 'phone_link' => '+393202948061', 'country' => 'United Kingdom', 'tawkto' => array('property' => '5bdc5798a5b4b877204268cb', 'widget' => 'default'), 'show_in_header_langs' => true, 'show_for_domain' => array('beshared.bg', 'beshared.eu'), 'currentLink' => 'https://beshared.eu', 'active' => true, 'hreflang' => 'en')))
in CompilerEngine.php line 59
at CompilerEngine->get('D:\\DEV\\XAMPP\\htdocs\\BeShared\\resources\\views/front/home_2023.blade.php', array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'canonical' => 'http://127.0.0.1:8000', 'services' => object(Collection), 'projects' => object(Collection), 'news' => object(Collection), 'current_page' => 'index', 'current_subpage' => 'home', 'request' => object(Request), 'admin' => null, 'pages_header' => object(Collection), 'pages_footer' => object(Collection), 'seo_og_type' => 'article', 'seo_title' => 'Full Service Digital Agency | BeShared', 'seo_description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'social_image' => 'http://127.0.0.1:8000/img/logo-social.jpg', 'footer_logos' => object(Collection), 'career_positions' => object(Collection), 'all_services' => object(Collection), 'cache_buster' => '20200411', 'currentDomain' => array('lang' => 'en', 'phone' => '+39 320 294 8061', 'phone_link' => '+393202948061', 'country' => 'United Kingdom', 'tawkto' => array('property' => '5bdc5798a5b4b877204268cb', 'widget' => 'default'), 'show_in_header_langs' => true, 'show_for_domain' => array('beshared.bg', 'beshared.eu'), 'currentLink' => 'https://beshared.eu', 'active' => true, 'hreflang' => 'en')))
in View.php line 137


(1/2) ErrorException
Undefined index: 127.0.0.1

in d3187463eae345eb4dbf0390f4d742b104703265.php line 27
at HandleExceptions->handleError(8, 'Undefined index: 127.0.0.1', 'D:\\DEV\\XAMPP\\htdocs\\BeShared\\storage\\framework\\views\\d3187463eae345eb4dbf0390f4d742b104703265.php', 27, array('__path' => 'D:\\DEV\\XAMPP\\htdocs\\BeShared\\storage\\framework\\views/d3187463eae345eb4dbf0390f4d742b104703265.php', '__data' => array('__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'canonical' => 'http://127.0.0.1:8000', 'services' => object(Collection), 'projects' => object(Collection), 'news' => object(Collection), 'current_page' => 'index', 'current_subpage' => 'home', 'request' => object(Request), 'admin' => null, 'pages_header' => object(Collection), 'pages_footer' => object(Collection), 'seo_og_type' => 'article', 'seo_title' => 'Full Service Digital Agency | BeShared', 'seo_description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'social_image' => 'http://127.0.0.1:8000/img/logo-social.jpg', 'footer_logos' => object(Collection), 'career_positions' => object(Collection), 'all_services' => object(Collection), 'cache_buster' => '20200411', 'currentDomain' => array('lang' => 'en', 'phone' => '+39 320 294 8061', 'phone_link' => '+393202948061', 'country' => 'United Kingdom', 'tawkto' => array('property' => '5bdc5798a5b4b877204268cb', 'widget' => 'default'), 'show_in_header_langs' => true, 'show_for_domain' => array('beshared.bg', 'beshared.eu'), 'currentLink' => 'https://beshared.eu', 'active' => true, 'hreflang' => 'en')), 'obLevel' => 1, '__env' => object(Factory), 'app' => object(Application), 'errors' => object(ViewErrorBag), 'canonical' => 'http://127.0.0.1:8000', 'services' => object(Collection), 'projects' => object(Collection), 'news' => object(Collection), 'current_page' => 'index', 'current_subpage' => 'home', 'request' => object(Request), 'admin' => null, 'pages_header' => object(Collection), 'pages_footer' => object(Collection), 'seo_og_type' => 'article', 'seo_title' => 'Full Service Digital Agency | BeShared', 'seo_description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', 'social_image' => 'http://127.0.0.1:8000/img/logo-social.jpg', 'footer_logos' => object(Collection), 'career_positions' => object(Collection), 'all_services' => object(Collection), 'cache_buster' => '20200411', 'currentDomain' => array('lang' => 'en', 'phone' => '+39 320 294 8061', 'phone_link' => '+393202948061', 'country' => 'United Kingdom', 'tawkto' => array('property' => '5bdc5798a5b4b877204268cb', 'widget' => 'default'), 'show_in_header_langs' => true, 'show_for_domain' => array('beshared.bg', 'beshared.eu'), 'currentLink' => 'https://beshared.eu', 'active' => true, 'hreflang' => 'en')))
in d3187463eae345eb4dbf0390f4d742b104703265.php line 27

Also due to composer install I get message nothing to install but then some error. May be here is the issue:

 composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Generating autoload files
Method Illuminate\Foundation\ComposerScripts::postAutoloadDump is not callable, can not call post-autoload-dump script
> @php artisan package:discover


  There are no commands defined in the "package" namespace.


Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

Solution

  • It seems my project is multi-domain (multi-tenant) and he just had to add localhost in the begining of domains.php Thanks Misho!

    "localhost" => [
        'lang' => 'bg',
        'phone' => '+359/878 788 469',
        'phone_link' => '+359/878 788 469',
        'country' => 'Bulgaria',
        'tawkto' => [
    "beshared.bg" => [
            'lang' => 'bg',
            'phone' => '+359/878 788 469',
            'phone_link' => '+359/878 788 469',
            'country' => 'Bulgaria',
            'tawkto' => [
                'property' => '5b9a47dbc666d426648ab989',
                'widget' => '1cnmdqpuu',
            ],
            'show_in_header_langs' => false,
            'show_for_domain' => 'beshared.bg',
            'currentLink' => 'https://beshared.bg',
            'active' => true,
            'hreflang' => 'bg-bg',
        ],
        "beshared.eu" => [
            'lang' => 'en',
            'phone' => '+39 320 294 8061',
            'phone_link' => '+393202948061',
            'country' => 'United Kingdom',
            'tawkto' => [
                'property' => '5bdc5798a5b4b877204268cb',
                'widget' => 'default',
            ],
            'show_in_header_langs' => true,
            'show_for_domain' => ['beshared.bg', 'beshared.eu'],
            'currentLink' => 'https://beshared.eu',
            'active' => true,
            'hreflang' => 'en',
        ],
        "it.beshared.eu" => [
            'lang' => 'it',
            'phone' => '+39 320 294 8061',
            'phone_link' => '+393202948061',
            'country' => 'Italy',
            'tawkto' => [
                'property' => '5bdc5798a5b4b877204268cb',
                'widget' => 'default',
            ],
            'show_in_header_langs' => true,
            'show_for_domain' => ['beshared.bg', 'beshared.eu'],
            'currentLink' => 'https://it.beshared.eu',
            'active' => true,
            'hreflang' => 'it',
        ],