Marco Maza
Marco Maza

Reputation: 25

Laravel - Call to undefined method Illuminate\Foundation\Application::run()

it's me again,

I'm still new in this Laravel world, I've overcome many issues but this one is driving me crazy. The error state the following:

Call to undefined method Illuminate\Foundation\Application::run()

I don't know where else to look. I found similar issues with the bindShared() and share() functions but not with the run().

I'm guessing it's a "core" function since it's the responsible for deploying the whole application.

I checked the following things:

Here is my htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} (.+)/$
    #RewriteRule ^ %1 [L,R=301]

    RewriteCond %{REQUEST_URI} !^/itccomercioexterior-system
    RewriteRule ^(.*)$ /itccomercioexterior-system/$1 [L]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L] 

</IfModule>

here is my index.php:

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

define('LARAVEL_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/laravel/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once __DIR__.'/laravel/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

try {
    $app->run();
} catch(\Exception $e) {
    echo "<pre>";
    echo $e;
    echo "</pre>";
}

And finally my tree view:

/project
├── css
│   ├── app.css
│   ├── bootstrap.css
│   ├── font-awesome.css
│   └── gridcss.css
├── favicon.ico
├── fonts
│   ├── fontawesome-webfont.eot
│   ├── fontawesome-webfont.svg
│   ├── fontawesome-webfont.ttf
│   ├── fontawesome-webfont.woff
│   └── fontawesome-webfont.woff2
├── index.php
├── js
│   ├── app.js
│   └── index.js
├── laravel
│   ├── app
│   ├── artisan
│   ├── bootstrap
│   ├── composer
│   ├── composer.json
│   ├── composer.lock
│   ├── config
│   ├── database
│   ├── package.json
│   ├── package-lock.json
│   ├── phpunit.xml
│   ├── readme.md
│   ├── resources
│   ├── routes
│   ├── server.php
│   ├── storage
│   ├── tests
│   ├── vendor
│   └── webpack.mix.js
├── media
│   ├── aduanas.jpg
│   ├── aduanas.png
│   ├── carousel001.jpg
│   ├── carousel002.jpg
│   ├── carousel003.png
│   ├── carousel004.jpg
│   ├── contacto.jpg
│   ├── curso1.jpg
│   ├── curso2.jpg
│   ├── curso3.jpg
│   ├── cursos.jpg
│   └── logo.webp
├── mix-manifest.json
├── robots.txt
├── storage
│   └── logs
└── web.config

Any insight will be appreciated!

Thank you all again!

Upvotes: 0

Views: 2697

Answers (1)

Diogo Sgrillo
Diogo Sgrillo

Reputation: 2701

The error is pretty clear: it doesn't exists a run method in the in the Illuminate\Foundation\Application class.

Where did this came from? It doesn't look like the index.php that comes with Laravel.

try {
    $app->run();
} catch(\Exception $e) {
    echo "<pre>";
    echo $e;
    echo "</pre>";
}

Have you try deleting it?

Upvotes: 1

Related Questions