Search code examples
phplaravelcomposer-phpphpstorm

Autoload issue in PhpStorm and Laravel


I have created a Laravel project using PhpStorm but when I open index.php in the browser it shows some errors.

It opens http://localhost:63342/METU/public/index.php but it should be http://localhost:63342/index.php.

Warning: require(C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17

What is wrong with my project?


Solution

  • That error generally occurs when you haven't run composer install on a new laravel project. The autoload file it references will be created when you run that command.

    As for the URL issue, you want to make sure your localhost is mapped to the /public folder of your laravel project, not mapped to the root of it.