I am working on php
with MongoDB
. On running the below script in wamp server
by going to localhost/test.php
, it gives the error:
Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\wamp64\www\test.php on line 3
The second error is
Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp64\www\test.php on line 3
I also installed composer
by composerSetup.exe
. Why it is giving the error?
<?php
require 'vendor/autolod.php';
$client = new Mongo\Client;
$companydb = $client->companydb;
$result1 = $companydb->createCollection('collection1');
var_dump(result1);
?>
while phpinfo()
is working fine after running this code.
<?php echo phpinfo(); ?>
Actually I followed this you tube video . He uses XAMP server and run command composer require "mongodb/mongodb=^1.0.0"
in xamp/htdocs/projectname/
but I used wampserver
and in wamp directory
there is no htdocs directory
. I think I am making mistake at this point. Is'nt it?