Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mstnorris's avatar

Fatal error: Class 'Illuminate\Foundation\Application' not found in /path/to/project/bootstrap/app.php on line 14

I have just run composer update and now I am getting the following error:

Fatal error: Class 'Illuminate\Foundation\Application' not found in /home/vagrant/Code/laravel/getwhiteboard/bootstrap/app.php on line 14

I have already set the $compiledPath variable in the bootstrap/autoload.php file to

$compiledPath = __DIR__.'/../vendor/compiled.php';
0 likes
26 replies
bastiaan89's avatar

That shouldn't impact your development environment, because with APP_DEBUG=true, you're not using the compiled file anyway. Have you tried running composer dumpauto?

1 like
RachidLaasri's avatar

Remove the "vendor" folder and "composer.lock" and run:

composer install
5 likes
mstnorris's avatar

Thank you both but it was me.

I removed the

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

and replaced it with the

$compiledPath = __DIR__.'/../vendor/compiled.php';

in error. That'll teach me to watch what I'm doing.

markmanley's avatar

Hi - noob here and excited to participate! I've got the same fatal error, but I see in my autoload.php file I've got both the require and the $compiledPath statements mentioned above. I see that $compiledPath is not getting set (compiled.php doesn't exist), but that shouldn't be impacting me in development mode, right? What else can I look for? TIA

mstnorris's avatar

autoload.php should look like (I've removed the comments)

<?php

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

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

$compiledPath = __DIR__.'/../storage/framework/compiled.php';

if (file_exists($compiledPath))
{
    require $compiledPath;
}
markmanley's avatar

the message: PHP Fatal error: Class 'Illuminate\Foundation\Application' not found in /Library/WebServer/Documents/laravel/billSearch/bootstrap/app.php on line 14

My script differs: the $compiledPath item is specified as:

    $compiledPath = __DIR__.'/../../vendor/compiled.php';

I modified it to the script you gave me and still getting the same error. TIA.

mstnorris's avatar

around line 14 in app.php is

$app = new Illuminate\Foundation\Application(
    realpath(__DIR__.'/../')
);
markmanley's avatar

confirming line 14 in app.php is identical. Yes, I ran composer dump-autoload -o. Result:

Mark-Manley:laravel markmanley2$ php composer.phar dump-autoload -o
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so, 9): image not found in Unknown on line 0
Generating optimized autoload files
Mark-Manley:laravel markmanley2$

Not sure if this matters, but I had to use "php composer.phar...". This makes me wonder if my environment is not set up correctly.

mstnorris's avatar

@markmanley

Firstly it looks like PHP Mcrypt extension isn't being loaded, either it isn't present or another error. Anyway, try installing it from here:

http://php-osx.liip.ch

Secondly, you just need to mv composer.phar to one of your executable directories. Open up your terminal and change directory cd to where composer.phar is currently. Then execute the following command.

mv composer.phar /usr/local/bin/composer
jonathan.soifer's avatar

Thank you Gyan.

After doing a git reset --hard a few directories were deleted and I was facing precisely the same issue.

composer update --no-scripts saved me.

iwalpola's avatar

Gyan, I made the same mistake!

So I corrected the composer.json, then deleted composer.lock and the vendor folder, and ran "composer update" again. Worked!!!

Jonathan, "composer update --no-scripts" is acceptable while developing, but not acceptable on the production server, as you're missing out on a lot of speed optimization. The scripts referred to in the command generate optimized class loader files, and even allows more advanced functions like compiled classes.

RushVan's avatar

Having the same issue each time I try to spin up and existing project on another machine.

@Gyan,

composer update --no-scripts

did the trick.

Thanks!

1 like
msyadav's avatar

I tried composer update --no-scripts but it gives error

[Symfony\Component\Console\Exception\RuntimeException] The "--no--scripts" option does not exist.

samdevries's avatar

For someone bumping into this issue. I had an older version of the artisan file that did not require the autoloader. Newer versions do.

You can try replacing your artisan file with a new one from the Laravel Github repo.

amol_c's avatar

FatalThrowableError in ProviderRepository.php line 146: Class 'Dingo\Api\Provider\LaravelServiceProvider' not found

composer update --no-scripts - does not give an error but when I run my project it gives above error.

Please help!

Abdellah's avatar

Hello, how can I solve this?

Uncaught Error: Interface 'Illuminate\Contracts\Foundation\CachesConfiguration' not found in C:\MAMP\htdocs\poblysh\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:29 Stack trace: #0 C:\MAMP\htdocs\poblysh\vendor\composer\ClassLoader.php(444): include() #1 C:\MAMP\htdocs\poblysh\vendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile('C:\\MAMP\\htdocs\\...') #2 [internal function]: Composer\Autoload\ClassLoader->loadClass('Illuminate\\Foun...') #3 C:\MAMP\htdocs\poblysh\bootstrap\app.php(14): spl_autoload_call('Illuminate\\Foun...') #4 C:\MAMP\htdocs\poblysh\artisan(20): require_once('C:\\MAMP\\htdocs\\...') #5 {main} thrown in C:\MAMP\htdocs\poblysh\vendor\laravel\framework\src\Illuminate\Foundation\Application.php on line 29

Bayo's avatar

Kindly help me to resolve this issue I cannot issue any command like php artisan migrate

It is throwing error -

In Application.php line 598: strpos() expects parameter 1 to be string, array given

[2020-09-22 16:45:52] local.ERROR: strpos() expects parameter 1 to be string, array given {"exception":"[object] (ErrorException(code: 0): strpos() expects parameter 1 to be string, array given at ~/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:598) [stacktrace] #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'strpos() expect...', '/Users/bayo/Amp...', 598, Array) #1 ~/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(598): strpos(Array, 'Illuminate\\') #2 ~/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(425): Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Array, 'aliases') #3 ~/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(599): Illuminate\Support\Collection->partition('aliases') #4 ~/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders() #5 ~/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(230): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application)) #6 ~/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array) #7 ~/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap() #8 ~/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 {main} "}

Snapey's avatar

@bayo

This is a 5 year old thread. Please start your own question, with your own situation.

junaidahmed's avatar

i have same this issue i install laravel another folder and delete vendor folder that make issue and copy the vendor folder from new laravel project now my issue is solve try this

Snapey's avatar

@junaidahmed ok so you post immediately below my moan at someone replying to 5 year old thread, and you do this 2 years later,

DONT copy vendor folder from another project. Delete composer.lock and then run Composer Install.

Please or to participate in this conversation.