Php link mongo database $ conn = new Mongo ("mongodb: // admin: admin @ localhost: 27017/local"); // This is row 11th
An error is reported after this writing.
(! ) Deprecated: main (): The Mongo class is deprecated, please use the same client class in D: \ bzyweb \ test2 \ conn. php on line 11
Call Stack
# Time Memory Function Location
1 0.0010 238592 {main} () .. \ conn. php: 0
(! ) Fatal error: Uncaught exception 'mongoonexception' with message 'failed' to connect to: localhost: 27017: Authentication Failed on database 'local' with username 'admin': auth fail' in D: \ bzyweb \ test2 \ conn. php on line 11
(! ) Failed connectionexception: failed to connect to: localhost: 27017: Authentication Failed on database 'local' with username 'admin': auth fails in D: \ bzyweb \ test2 \ conn. php on line 11
Call Stack
# Time Memory Function Location
1 0.0010 238592 {main} () .. \ conn. php: 0
2 0.0010 239720 _ construct () .. \ conn. php: 11
Reply to discussion (solution)
Deprecated: main (): The Mongo class is deprecated, please use the specified client class
Objection: the main (): Mongo class is outdated. use the mongoclient class.
Echo "mongo contact:
";
// $ DB = new PDO ("mongodb: host = localhost; port = 27017; dbname = aaa", "admin", "admin ");
$ Conn = new MongoClient ("mongodb: // admin: admin @ localhost2: 27017/local ");
?>
Error message
Mongo contact:
(! ) Fatal error: Uncaught exception 'Your ononexception' with message 'Your client ::__ construct (): 'In D: \ bzyweb \ test2 \ conn. php on line 4
(! ) Lost connectionexception: Lost client ::__ construct (): in D: \ bzyweb \ test2 \ conn. php on line 4
Call Stack
# Time Memory Function Location
1 0.0000 240416 {main} () .. \ conn. php: 0
2 0.0000 240672 _ construct () .. \ conn. php: 4
What is yours? Mongo manager?
Let's see how he wrote it.
It is a web management address of tranquility. I have read a lot of statements, as if the links are all written in that way. I don't know why I 've made a mistake, so I posted the database structure, I want to make it clearer.
$ Dsn = "mongodb: // localhost: 27017/admin: admin/aaa ";
$ M = new Alibaba client ($ dsn );
No error reported