I worked with a project using composer.But when i run the index file,system shows the following error,
Warning: require_once(vendor/autoload.php): failed to open stream: No such file or directory in D:\xampp\htdocs\instagram_php\index.php on line 5
Fatal error: require_once(): Failed opening required 'vendor/autoload.php' (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\instagram_php\index.php on line 5
I have installed composer from https://getcomposer.org/. What am doing wrong?
You are using require_oncewith a relative path. It is possible but there are so many things that can go wrong that I usually avoid it.
Where is the vendorfolder relative to index.php? I recommend using an absolute path. You can use the magic constants to determine it:
require_once(__DIR__ . '/vendor/autoload.php');
NOTE: you can use /.. to go up the directory tree.
NOTE2: __DIR__ requires php 5.3 or higher. You can use dirname(__FILE__) for older versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With