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

mariona19's avatar

php artisan migrate

when im trying to run the php artisan migrate command in cmd i am getting: Could not open input file: artisan

kindly assist

0 likes
15 replies
tykus's avatar

Are you running this in the root of your project?

mariona19's avatar

yes i figured that out and now im getting this error

C:\Users\mzahr\blog>php artisan migrate PHP Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14

Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14

mariona19's avatar

i tried it and resulted into another error : Generating optimized autoload files Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script

@php artisan package:discover

Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14 PHP Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14 Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

rin4ik's avatar

@mariona19 Remove the vendor folder and composer.lock and run command:

composer install  

that should fix the problem

tykus's avatar

Whenever you clone a project, you need to install the dependencies. So your typical steps will be first composer install and then php artisan migrate

mariona19's avatar

@rin4ik it updated the dependencies but when i tried php aritsan migrate again i got the same error PHP Warning: require(C:\Users\mzahr\blog/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\mzahr\blog\artisan on line 18

Warning: require(C:\Users\mzahr\blog/vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\mzahr\blog\artisan on line 18 PHP Fatal error: require(): Failed opening required 'C:\Users\mzahr\blog/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\mzahr\blog\artisan on line 18

Fatal error: require(): Failed opening required 'C:\Users\mzahr\blog/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\mzahr\blog\artisan on line 18

tykus's avatar

Did the composer install step complete fully without errors? It should have created the autoload files, but you can do this using composer dump-autoload

mariona19's avatar

@rin4ik another error Generating optimized autoload files Class Illuminate\Foundation\ComposerScripts is not autoloadable, can not call post-autoload-dump script

@php artisan package:discover

Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14 PHP Fatal error: Class 'Illuminate\Foundation\Application' not found in C:\Users\mzahr\blog\bootstrap\app.php on line 14 Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

rin4ik's avatar

in public/index.php file you have these lines?


require __DIR__.'/../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__.'/../bootstrap/app.php';
mariona19's avatar

one question just to make sure how can i update my php from the cmd becuase i think i have an old version which is not compatible

rin4ik's avatar

@mariona19 I don't think that it's related to php version. please check this in your routes/web.php file to know your current php version:

Route::get('phpinfo', function () {
    phpinfo();
});

check in browser domain.test/phpinfo

ashishpatel's avatar

check first you have artisan file in your root directory.

lezard's avatar

coming from google, burner account just to answere here. nobody seemed to notice they had this path specified:

C:\Users\mzahr\blog/vendor/autoload.php

they are obviously on xampp, and the path can NEVER work when trying to match unix/path/style to a windows\path\style

Please or to participate in this conversation.