Class 'MongoClient' not found in file Controller\AppController.php - php

Hi there I'm try to connect mongo DB(Version 3.4.18) using CakePHP (version 3.5.1) with Apache server on PHP (7.2.4) and facing below error
2019-07-01 10:41:09 Error: [Error] Class 'MongoClient' not found in E:\xampp\htdocs\myproject\src\Controller\AppController.php on line 142
Request URL: /
Stack Trace:
#0 E:\xampp\htdocs\myproject\src\Controller\PagesController.php(219): App\Controller\AppController->__connectmongodb()
#1 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Controller\Controller.php(441): App\Controller\PagesController->home()
#2 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\ActionDispatcher.php(119): Cake\Controller\Controller->invokeAction()
#3 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\ActionDispatcher.php(93): Cake\Http\ActionDispatcher->_invoke(Object(App\Controller\PagesController))
#4 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\BaseApplication.php(103): Cake\Http\ActionDispatcher->dispatch(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#5 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Http\BaseApplication->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#6 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Routing\Middleware\RoutingMiddleware.php(107): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#7 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Routing\Middleware\RoutingMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#8 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Routing\Middleware\AssetMiddleware.php(88): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#9 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Routing\Middleware\AssetMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#10 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Error\Middleware\ErrorHandlerMiddleware.php(93): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#11 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): Cake\Error\Middleware\ErrorHandlerMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#12 E:\xampp\htdocs\myproject\vendor\cakephp\debug_kit\src\Middleware\DebugKitMiddleware.php(52): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#13 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(65): DebugKit\Middleware\DebugKitMiddleware->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response), Object(Cake\Http\Runner))
#14 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Runner.php(51): Cake\Http\Runner->__invoke(Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#15 E:\xampp\htdocs\myproject\vendor\cakephp\cakephp\src\Http\Server.php(81): Cake\Http\Runner->run(Object(Cake\Http\MiddlewareQueue), Object(Cake\Http\ServerRequest), Object(Cake\Http\Response))
#16 E:\xampp\htdocs\myproject\webroot\index.php(40): Cake\Http\Server->run()
#17 {main}
for mongo db connection trying below code
public function __connectmongodb()
{
$m = new \MongoClient('mongodb://localhost:27017');
return $db = $m->myDb;
}
Note: I have to do this in mongo DB(Version 3.4.18) using CakePHP (version 3.5.1) with Apache server on PHP (7.2.4) these specific versions
UPDATE - we trying on windows using php_mongodb-1.4.0-7.2-ts-vc15-x64 this .dll file

php_mongodb-1.4.0-7.2-ts-vc15-x64 is the "new" or rather the only officially supported driver https://pecl.php.net/package/mongodb. Its usage is documented here https://www.php.net/manual/en/set.mongodb.php and is basically uses MongoDB\Driver\Manager.
The MongoClient is from legacy and deprecated long time ago driver: https://pecl.php.net/package/mongo. It is documented here https://www.php.net/manual/en/book.mongo.php
There is no official support of the legacy driver for PHP 7: https://jira.mongodb.org/browse/PHP-1474
Last time the legacy driver was listed on https://docs.mongodb.com/ecosystem/drivers/php/ back in February 2018. By then it was claimed to be compatible with mongodb server v2.4, v2.6, and v3.0 with no compatibility with databases v3.2+.
The same February 2018 mongodb v3.0 retired. Support of Mongodb v3.2 has been dropped later in 2018 and v3.4 is counting its last months of support till January 2020.
Long story short, no you don't actually want this using MongoClient.

Related

Fatal error: Uncaught Error: Class "VBORemindersHelper" Vik Booking Plugin Wordpress

I am trying to use VikBooking on my localhost (XAMPP). After installing and activating the plugin, this error keeps popping up anytime I want to configure or import sample data.
Fatal error: Uncaught Error: Class "VBORemindersHelper" not found in
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\helpers\widgets\reminders.php:420
Stack trace: #0
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\helpers\admin_widgets.php(336):
VikBookingAdminWidgetReminders->preload() #1
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\layouts\sidepanel\multitasking.php(32):
VikBookingHelperAdminWidgets->getWidgetNames(true) #2
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\libraries\adapter\layout\file.php(135):
include('C:\xampp\htdocs...') #3
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\libraries\adapter\layout\helper.php(69):
JLayoutFile->render(Array) #4
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\helpers\helper.php(222):
JLayoutHelper::render('sidepanel.multi...', Array) #5
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\controller.php(5443):
VikBookingHelper::printHeader('1') #6
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\libraries\adapter\mvc\controller.php(323): VikBookingController->prices() #7
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\libraries\system\body.php(55):
JController->execute('prices') #8
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\vikbooking.php(196):
VikBookingBody::process() #9
C:\xampp\htdocs\hotel\wp-includes\class-wp-hook.php(307):
{closure}('') #10
C:\xampp\htdocs\hotel\wp-includes\class-wp-hook.php(331):
WP_Hook->apply_filters(NULL, Array) #11
C:\xampp\htdocs\hotel\wp-includes\plugin.php(474):
WP_Hook->do_action(Array) #12
C:\xampp\htdocs\hotel\wp-settings.php(587): do_action('init') #13
C:\xampp\htdocs\hotel\wp-config.php(96):
require_once('C:\xampp\htdocs...') #14
C:\xampp\htdocs\hotel\wp-load.php(50):
require_once('C:\xampp\htdocs...') #15
C:\xampp\htdocs\hotel\wp-admin\admin.php(34):
require_once('C:\xampp\htdocs...') #16 {main} thrown in
C:\xampp\htdocs\hotel\wp-content\plugins\vikbooking\admin\helpers\widgets\reminders.php
on line 420
That used to be a conflict with Windows servers and the new spl autoload register functions introduced with the 1.5.x series of Vik Booking for WordPress. Due to an unescaped backslash (Windows directory separator is a backslash rather than a slash like on Linux/Unix servers) in a regex, the spl autoloader was unable to require the proper class file for one admin widget. Just update the plugin to its latest version and that error will disappear.
In any case, you can contact the tech VikWP team by using the official website. You will get a prompt answer.

PDOException during Drupal 8 project migration

I have a Drupal 8 project developed on my local. I am trying to move it to Client server which is Windows server 2008 R2 version. Steps I followed:
Restored database on DB server (MS SQL)
Moved all the project files into client web server
Installed PHP 7.3 and it's dependancies (wincache, PHP manager etc)
Dropped PDO_sqlsrv drivers into appropriate folders and edited PHP.ini with those locations
Changed DB configs in settings.php
When I start the site in IIS I see the Drupal "website encountered error" message. On the log file I see the below errors:
PDOException: in D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\PhpArrayContainer.php on line 79 #0 D:\myproject\web\core\lib\Drupal\Core\Database\Database.php(371): Drupal\Driver\Database\sqlsrv\Connection::open(Array)
#1 D:\myproject\web\core\lib\Drupal\Core\Database\Database.php(166): Drupal\Core\Database\Database::openConnection('default', 'default')
#2 [internal function]: Drupal\Core\Database\Database::getConnection('default')
#3 D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\PhpArrayContainer.php(79): call_user_func_array('Drupal\\Core\\Dat...', Array)
#4 D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\Container.php(173): Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'database')
#5 D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\PhpArrayContainer.php(260): Drupal\Component\DependencyInjection\Container->get('database', 1)
#6 D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\PhpArrayContainer.php(62): Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters(Array)
#7 D:\myproject\web\core\lib\Drupal\Component\DependencyInjection\Container.php(173): Drupal\Component\DependencyInjection\PhpArrayContainer->createService(Array, 'cache.container')
#8 D:\myproject\web\core\lib\Drupal\Core\DrupalKernel.php(543): Drupal\Component\DependencyInjection\Container->get('cache.container')
#9 D:\myproject\web\core\lib\Drupal\Core\DrupalKernel.php(904): Drupal\Core\DrupalKernel->getCachedContainerDefinition()
#10 D:\myproject\web\core\lib\Drupal\Core\DrupalKernel.php(476): Drupal\Core\DrupalKernel->initializeContainer()
#11 D:\myproject\web\core\lib\Drupal\Core\DrupalKernel.php(692): Drupal\Core\DrupalKernel->boot()
#12 D:\myproject\web\index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#13 {main}
Not sure how to fix this. Any help?!

Yii2 migration can't find database

I'm trying to migrate two table from extension created by me. I've created it on XAMPP and my migration worked fine there ( tested it few times ). Then I decided to test it on another server and what I get as an error is:
Exception 'yii\db\Exception' with message 'SQLSTATE[HY000] [1045] Access denied for user 'ivailo'#'localhost' (using password: YES)'
in Z:\extension\slide\vendor\yiisoft\yii2\db\Connection.php:624
Stack trace:
#0 Z:\extension\slide\vendor\yiisoft\yii2\db\Connection.php(996): yii\db\Connection->open()
#1 Z:\extension\slide\vendor\yiisoft\yii2\db\Connection.php(983): yii\db\Connection->getMasterPdo()
#2 Z:\extension\slide\vendor\yiisoft\yii2\db\Command.php(253): yii\db\Connection->getSlavePdo()
#3 Z:\extension\slide\vendor\yiisoft\yii2\db\Command.php(1143): yii\db\Command->prepare(true)
#4 Z:\extension\slide\vendor\yiisoft\yii2\db\Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL)
#5 Z:\extension\slide\vendor\yiisoft\yii2\db\mysql\Schema.php(312): yii\db\Command->queryAll()
#6 Z:\extension\slide\vendor\yiisoft\yii2\db\mysql\Schema.php(125): yii\db\mysql\Schema->findColumns(Object(yii\db\TableSchema))
#7 Z:\extension\slide\vendor\yiisoft\yii2\db\Schema.php(744): yii\db\mysql\Schema->loadTableSchema('migration')
#8 Z:\extension\slide\vendor\yiisoft\yii2\db\Schema.php(194): yii\db\Schema->getTableMetadata('{{%migration}}', 'schema', true)
#9 Z:\extension\slide\vendor\yiisoft\yii2\console\controllers\MigrateController.php(210): yii\db\Schema->getTableSchema('{{%migration}}
', true)
#10 Z:\extension\slide\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(875): yii\console\controllers\MigrateControlle
r->getMigrationHistory(NULL)
#11 Z:\extension\slide\vendor\yiisoft\yii2\console\controllers\BaseMigrateController.php(166): yii\console\controllers\BaseMigrateContr
oller->getNewMigrations()
#12 [internal function]: yii\console\controllers\BaseMigrateController->actionUp(0)
#13 Z:\extension\slide\vendor\yiisoft\yii2\base\InlineAction.php(57): call_user_func_array(Array, Array)
#14 Z:\extension\slide\vendor\yiisoft\yii2\base\Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#15 Z:\extension\slide\vendor\yiisoft\yii2\console\Controller.php(148): yii\base\Controller->runAction('up', Array)
#16 Z:\extension\slide\vendor\yiisoft\yii2\base\Module.php(528): yii\console\Controller->runAction('up', Array)
#17 Z:\extension\slide\vendor\yiisoft\yii2\console\Application.php(180): yii\base\Module->runAction('migrate/up', Array)
#18 Z:\extension\slide\vendor\yiisoft\yii2\console\Application.php(147): yii\console\Application->runAction('migrate/up', Array)
#19 Z:\extension\slide\vendor\yiisoft\yii2\base\Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request
))
#20 Z:\extension\slide\yii(23): yii\base\Application->run()
#21 {main}
My Yii2 is fresh installed one. Only added the extension via composer. Database configuration is correct ( user and password that we are using for years ). I've created test table and executed one line Yii::$app->db->createCommand('INSERT INTO test VALUES (1,'testname')') and that passed fine. That way I decide that the connection is ok. But with console migration php yii migrate/up --migrationPath=#vendor/********/*******/migrations it gave me the error above. Want to mention that I am not familiar with our server configurations ( All I know is OS: Ubuntu 14.04 H: Apache2 ) and system administrating at all if the problem is about that somehow. Thank you in advance!

Unsupported operand types CakePHP

I have a CakePHP project running on other server PHP 5.6 but here this same app is not running on PHP 5.6 / 7.0.
I am using Croogo with CakePHP.
It's showing me debug error like below:
Error: [Error] Unsupported operand types
Stack Trace:
#0 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(282): include()
#1 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(201): CakePlugin::_includeFile('/var/www/vhosts...', true)
#2 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(121): CakePlugin::bootstrap('Acl')
#3 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(94): CakePlugin::load('Acl', Array)
#4 /Vendor/croogo/croogo/Extensions/Lib/CroogoPlugin.php(656): CakePlugin::load(Array, Array)
#5 /Vendor/croogo/croogo/Croogo/Config/croogo_bootstrap.php(126): CroogoPlugin::load(Array)
#6 /Vendor/croogo/croogo/Croogo/Config/bootstrap.php(8): require_once('/var/www/vhosts...')
#7 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(282): include('/var/www/vhosts...')
#8 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(201): CakePlugin::_includeFile('/var/www/vhosts...', false)
#9 /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(121): CakePlugin::bootstrap('Croogo')
#10 /Config/bootstrap.php(78): CakePlugin::load('Croogo', Array)
#11 /Vendor/cakephp/cakephp/lib/Cake/Core/Configure.php(98): include('/var/www/vhosts...')
#12 /Vendor/cakephp/cakephp/lib/Cake/bootstrap.php(432): Configure::bootstrap(true)
#13 /webroot/index.php(90): include('/var/www/vhosts...')
#14 {main}
It is from my tmp/logs/error.log file
Is there any fix?
Thanks in advance
Try debugging this place: /Vendor/cakephp/cakephp/lib/Cake/Core/CakePlugin.php(282): include() #1. See which file it's trying to include when failing and what's in it.

Typo3 solr not showing search result

I have successfully managed to install solr with typo3 6.2
Solr version 4.2
Typo3 version 6.2
Typo3 solr extension 2.8
Indexing processing is working fine as I am not getting anything in the devlog extension .But the problem is that when i try to search something in front end I am getting an error like this.
Es tut uns leid. Ihre Suchanfrage konnte nicht verarbeitet werden.
And in Backend typo3 devlog am getting an error like this
0: exception 'Apache_Solr_ParserException' with message 'Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method' in /html/typo3/typo3conf/ext/solr/lib/SolrPhpClient/Apache/Solr/Response.php:206 Stack trace: #0 /html/typo3/typo3conf/ext/solr/lib/SolrPhpClient/Apache/Solr/Response.php(164): Apache_Solr_Response->_parseData() #1 /html/typo3/typo3conf/ext/solr/classes/class.tx_solr_search.php(365): Apache_Solr_Response->__get('response') #2 /html/typo3/typo3conf/ext/solr/pi_results/class.tx_solr_pi_results.php(167): tx_solr_Search->getNumberOfResults() #3 /html/typo3/typo3conf/ext/solr/classes/pluginbase/class.tx_solr_pluginbase_commandpluginbase.php(62): tx_solr_pi_results->getCommandList() #4 /html/typo3/typo3conf/ext/solr/classes/pluginbase/class.tx_solr_pluginbase_pluginbase.php(106): tx_solr_pluginbase_CommandPluginBase->render(NULL) #5 [internal function]: tx_solr_pluginbase_PluginBase->main('', Array) #6 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(6579): call_user_func_array(Array, Array) #7 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php(41): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction('tx_solr_pi_resu...', Array, '') #8 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(863): TYPO3\CMS\Frontend\ContentObject\UserContentObject->render(Array) #9 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3641): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->USER(Array) #10 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3589): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript_process(Array) #11 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3557): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent() #12 /html/typo3/typo3_src-6.2.4/typo3/sysext/cms/tslib/index_ts.php(231): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript() #13 /html/typo3/typo3_src-6.2.4/index.php(28): require('/html/typo3/typ...') #14 {main}
0: exception 'Apache_Solr_ParserException' with message 'Solr response does not appear to be valid JSON, please examine the raw response with getRawResponse() method' in /html/typo3/typo3conf/ext/solr/lib/SolrPhpClient/Apache/Solr/Response.php:206 Stack trace: #0 /html/typo3/typo3conf/ext/solr/lib/SolrPhpClient/Apache/Solr/Response.php(164): Apache_Solr_Response->_parseData() #1 /html/typo3/typo3conf/ext/solr/classes/class.tx_solr_search.php(365): Apache_Solr_Response->__get('response') #2 /html/typo3/typo3conf/ext/solr/pi_results/class.tx_solr_pi_results.php(167): tx_solr_Search->getNumberOfResults() #3 /html/typo3/typo3conf/ext/solr/classes/pluginbase/class.tx_solr_pluginbase_commandpluginbase.php(62): tx_solr_pi_results->getCommandList() #4 /html/typo3/typo3conf/ext/solr/classes/pluginbase/class.tx_solr_pluginbase_pluginbase.php(106): tx_solr_pluginbase_CommandPluginBase->render(NULL) #5 [internal function]: tx_solr_pluginbase_PluginBase->main('', Array) #6 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(6579): call_user_func_array(Array, Array) #7 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php(41): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction('tx_solr_pi_resu...', Array, '') #8 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php(863): TYPO3\CMS\Frontend\ContentObject\UserContentObject->render(Array) #9 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3641): TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->USER(Array) #10 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3589): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript_process(Array) #11 /html/typo3/typo3_src-6.2.4/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php(3557): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->recursivelyReplaceIntPlaceholdersInContent() #12 /html/typo3/typo3_src-6.2.4/typo3/sysext/cms/tslib/index_ts.php(231): TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController->INTincScript() #13 /html/typo3/typo3_src-6.2.4/index.php(28): require('/html/typo3/typ...') #14 {main}
Can someone help me with this ??
Any kind of help will appreciated
Thanks in advance
as far as i know Typo3 solr extension 2.8 is not compatible with typo3 6.2. Use 3.0.0 instead

Categories