Summer Sale! All accounts are 50% off this week.

Webiondev123's avatar

autoload.php fail

I have tried everything

still doesnt work

my autoload.php file in vendor folder contains

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit2ae5c5c1e631de0cea8c30d579d66b7e::getLoader();

WHen I try to load my website on localhost


( ! ) Warning: require(C:\wamp\www\fundtheneedy/../vendor/autoload.php): failed to open stream: No such file or directory in C:\wamp\www\fundtheneedy\index.php on line 24
Call Stack
#   Time    Memory  Function    Location
1   0.0009  364864  {main}( )   ...\index.php:0

( ! ) Fatal error: require(): Failed opening required 'C:\wamp\www\fundtheneedy/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp\www\fundtheneedy\index.php on line 24
Call Stack
#   Time    Memory  Function    Location
1   0.0009  364864  {main}( )   ...\index.php:0
0 likes
13 replies
Saikishore's avatar

did you update composer after pull the code ? composer update

nadj's avatar

I think you need to run

composer dump-autoload

to refresh the paths.

1 like
Saikishore's avatar

try this composer dump-autoload. Also check Storage folder permissions and sessions, views, cache folders in frameork folder.

Webiondev123's avatar

I ran dump command


c:\wamp64\www\fundtheneedy>composer dump-autoload
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
Discovered Package: fideloper/proxy
Discovered Package: intervention/image
Discovered Package: khill/lavacharts
Discovered Package: laravel/scout
Discovered Package: laravel/tinker
Discovered Package: nesbot/carbon
Package manifest generated successfully.

still same problem

nadj's avatar

@Webiondev123 where is your vendor folder? Is it in C:\wamp\www\ or in C:\wamp\www\fundtheneedy ?

nadj's avatar
nadj
Best Answer
Level 9

Then the path in your index.php is not right. Look at the line 24 now it reads: C:\wamp\www\fundtheneedy/../vendor/autoload.php I think it should be: C:\wamp\www\fundtheneedy/vendor/autoload.php

Webiondev123's avatar

@nadj i am now having another problem

when I fix path in localhost as

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

It gives error in production saying autoload not found. but when I revert back to

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

localhost gives the same error

nadj's avatar

Can you please post your public/index.php here?

Webiondev123's avatar
<?php



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



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



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



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

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

$response->send();

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



nadj's avatar

My index.php looks different there is no require __DIR__.'/../vendor/autoload.php'; in mine

<?php

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

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


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

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

$response->send();

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

Please or to participate in this conversation.