0

I have started a new Laravel Project and wanted to test it on my localhost... When I view the site I get an error message saying:

Warning: require(C:\xampp\htdocs\public/../Website/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Website\public\index.php on line 24 Fatal Error: require(): Failed opening required 'C:\xampp\htdocs\Website\public/../Website/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Website\public\index.php on line 24

I looked it up, but I found the autoload.php file in all folders and I already tried composer update --no-scrips. I just don't get why it isn't loading the project.

'Website' is the name of my Laravel project folder btw.

Lelio Faieta
  • 6,457
  • 7
  • 40
  • 74
Dennis M.
  • 107
  • 1
  • 2
  • 7
  • What is your DIR structure? – Script47 Jul 19 '18 at 13:19
  • Possible duplicate of [Laravel 5 Failed opening required bootstrap/../vendor/autoload.php](https://stackoverflow.com/questions/28468625/laravel-5-failed-opening-required-bootstrap-vendor-autoload-php) – Script47 Jul 19 '18 at 13:20
  • Try deleting `composer.lock` file and then do `update composer` and then try again. – Himanshu Upadhyay Jul 19 '18 at 13:20
  • 2
    `index.php` is under `Website\public\index.php` but you're looking for autoload under `public/../Website/vendor/autoload.php` which translates to `Website/Website/vendor/autoload.php` which looks wrong. – apokryfos Jul 19 '18 at 13:24
  • @HimanshuUpadhyay Just tried it, but didn't help :/ – Dennis M. Jul 19 '18 at 13:26
  • @apokryfos How did that happen? – Dennis M. Jul 19 '18 at 13:26
  • 1
    It would happen if you modified your `index.php` . [the original one](https://github.com/laravel/laravel/blob/master/public/index.php#L24) does `require __DIR__.'/../vendor/autoload.php'` which is the correct path. Compare what you have to the source code one and see if everything looks correct – apokryfos Jul 19 '18 at 13:28
  • @apokryfos Hmm, that's strange. I didn't edit my index.php, but thanks for the answer I try to fix it :) – Dennis M. Jul 19 '18 at 13:31

2 Answers2

1

I fixed the problem thanks to apokryfos. In the autoload file the DIR.'/../vendor/autoload.php' was changed to DIR.'/../Website/vendor/autoload.php' which was the wrong path. I don't know how this could happen, but simply deleting the 'Website/' seemed to fix the problem. Thanks again to apokryfos.

Dennis M.
  • 107
  • 1
  • 2
  • 7
0

Turns out I didn't enable openssl in my php.ini so when I created my new project with composer it was installed from source. I changed that and ran

composer update

now the vendor folder was created

Parveen Chauhan
  • 1,396
  • 12
  • 25