PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 7, 2022

[FIXED] Autoload Error: No such file or directory

 January 07, 2022     autoload, composer-php, php     No comments   

Issue

I have included autoload.php in the header of my site

include 'vendor/autoload.php'; 

From this i am receiving the following errors on my site:

Warning: require_once(DIR/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in /homepages/6/d416629391/htdocs/leftovercheese/vendor/autoload.php on line 5

Fatal error: require_once() [function.require]: Failed opening required 'DIR/composer/autoload_real.php' (include_path='.:/usr/lib/php5') in /homepages/6/d416629391/htdocs/leftovercheese/vendor/autoload.php on line 5

My code is:

// autoload.php generated by Composer

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

return ComposerAutoloaderInit8be239f5caef32db03f87bb271ed6012::getLoader();

PHP Version: 5.2.17

Any ideas?


Solution

You have to load vendor/autoload.php, which will autoload that file for you:

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

This is assuming that your file is located at the same directory level as the vendor directory.

Otherwise, adjust.



Answered By - Joseph Silber
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing