I have installed fresh magento 2.41 in windows with xamp. I have followed this tutorial to install.
After installation I am receiving this error An error has happened during application run. See exception log for details. while I am accessing either homepage or admin page.
I am accessing the magento site from this url http://mystore.magento.com/. If I access from localhost/magento241 it's showing 404 not found.
I tried to clear cache but it didn't worked.
Log Files are here :
1 exception(s):
Exception #0 (Exception): Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES - assumed 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\magento241\vendor\magento\framework\Encryption\Adapter\SodiumChachaIetf.php on line 40
Exception #0 (Exception): Warning: Use of undefined constant SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES - assumed 'SODIUM_CRYPTO_AEAD_CHACHA20POLY1305_IETF_NPUBBYTES' (this will throw an Error in a future version of PHP) in C:\xampp\htdocs\magento241\vendor\magento\framework\Encryption\Adapter\SodiumChachaIetf.php on line 40
<pre>#1 Magento\Framework\Encryption\Adapter\SodiumChachaIetf->encrypt() called at [vendor\magento\framework\Encryption\Encryptor.php:399]
#2 Magento\Framework\Encryption\Encryptor->encryptWithFastestAvailableAlgorithm() called at [vendor\magento\module-config\App\Config\Type\System.php:339]
#3 Magento\Config\App\Config\Type\System->cacheData() called at [vendor\magento\framework\Cache\LockGuardedCacheLoader.php:137]
#4 Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() called at [vendor\magento\module-config\App\Config\Type\System.php:281]
#5 Magento\Config\App\Config\Type\System->loadDefaultScopeData() called at [vendor\magento\module-config\App\Config\Type\System.php:207]
#6 Magento\Config\App\Config\Type\System->getWithParts() called at [vendor\magento\module-config\App\Config\Type\System.php:181]
#7 Magento\Config\App\Config\Type\System->get() called at [vendor\magento\framework\App\Config.php:132]
#8 Magento\Framework\App\Config->get() called at [vendor\magento\module-backend\App\Config.php:51]
#9 Magento\Backend\App\Config->getValue() called at [vendor\magento\module-backend\App\Area\FrontNameResolver.php:109]
#10 Magento\Backend\App\Area\FrontNameResolver->getFrontName() called at [vendor\magento\module-backend\Helper\Data.php:209]
#11 Magento\Backend\Helper\Data->getAreaFrontName() called at [vendor\magento\module-backend\App\Request\PathInfoProcessor.php:50]
#12 Magento\Backend\App\Request\PathInfoProcessor->process() called at [generated\code\Magento\Backend\App\Request\PathInfoProcessor\Proxy.php:95]
#13 Magento\Backend\App\Request\PathInfoProcessor\Proxy->process() called at [vendor\magento\framework\App\Request\Http.php:148]
#14 Magento\Framework\App\Request\Http->getOriginalPathInfo() called at [vendor\magento\framework\App\Request\Http.php:163]
#15 Magento\Framework\App\Request\Http->getPathInfo() called at [vendor\magento\framework\App\Request\Http.php:213]
#16 Magento\Framework\App\Request\Http->getFrontName() called at [vendor\magento\framework\App\Http.php:111]
#17 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:23]
#18 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:264]
#19 Magento\Framework\App\Bootstrap->run() called at [pub\index.php:30]
</pre>
https://drive.google.com/drive/folders/1OJaik33qhQL-X3X26LhFJBtUrk4bU5Cm?usp=sharing
Please make sure you have installed the sodium PHP extension.
You can check that with php -i | grep -i sodium
On Windows
Add "extension=sodium" to php.ini (no quotes)
Copy php/libsodium.dll to apache/bin/
Restart Apache
This works for me works on Windows.
I changed my php version from 8.0 to 8.1 on my linux (centOS) web hosting and had to add the following line to the relevant php.ini showing in phpinfo():
extension=php_sodium.dll
Once I did this the problem was solved!
Related
I am working on a application that uploads and shows file from google drive to a website and for that i am using google drive api in php and i have followed the quickstart.php when i enter the verification code it shows me some error
PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php:67
Stack trace:
#0 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(67): count()
#1 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(141): GuzzleHttp\Handler\CurlFactory->release()
#2 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php(103): GuzzleHttp\Handler\CurlFactory::finishError()
#3 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php(43): GuzzleHttp\Handler\CurlFactory::finish()
#4 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(28): GuzzleHttp\Handler\CurlHandler->__invoke()
#5 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php(51): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#6 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(72): GuzzleHttp\Handler\Proxy::GuzzleHttp\Handler{closure}()
#7 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke()
#8 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php(68): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#9 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Middleware.php(57): GuzzleHttp\RedirectMiddleware->__invoke()
#10 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\HandlerStack.php(67): GuzzleHttp\Middleware::GuzzleHttp{closure}()
#11 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(268): GuzzleHttp\HandlerStack->__invoke()
#12 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(96): GuzzleHttp\Client->transfer()
#13 D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Client.php(104): GuzzleHttp\Client->sendAsync()
#14 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\HttpHandler\Guzzle6HttpHandler.php(34): GuzzleHttp\Client->send()
#15 D:\xampp\htdocs\google-drive-api\vendor\google\auth\src\OAuth2.php(492): Google\Auth\HttpHandle#16 D:\xampp\htdocs\google-drive-api\vendor\google\apiclient\src\Google\Client.php(184): Google\Auth\OAuth2->fetchAuthToken()
#17 D:\xampp\htdocs\google-drive-api\google-drive.php(52): Google_Client->fetchAccessTokenWithAuthCode()
#18 D:\xampp\htdocs\google-drive-api\google-drive.php(70): getClient()
#19 {main}
thrown in D:\xampp\htdocs\google-drive-api\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php on line 67
Must be a problem with the php version . I was on php8 and was facing the same issue but when once I change to php7.3 the error became warning. Since the major changes in php7.4 and greater that might be causing the error of count()
As of PHP 7.2, the count() function will throw a warning when a value passed into it is not countable. Later on, this was made to throw a fatal error in PHP 8.0
See https://www.php.net/manual/en/function.count.php
Changelog
Version
Description
PHP 7.2
count() will now yield a warning on invalid countable types passed to the value parameter.
Since PHP 8.0 is a relatively new (and major) release that just came out 4 months ago in November, there is a good chance that a very large portion of PHP libraries aren't up to date yet. (I'm still developing in PHP 7.4 because of this.)
Assuming you're using the google/apiclient package, you should be good to go now as it seems to have been updated to support PHP 8.0 on Jan 19th in v2.9.0 (almost a month after you asked this question).
Edit: This is all based on the assumption you're running PHP 8.0, as this is the only version of PHP that throws a fatal error when passing a non countable variable into count().
I was hosting a webserver with XAMPP for a LAN wiki on Ubuntu. I managed to get it up and running and invested a lot of time into writing content and pages for the Wiki.
Some point later I installed Php and suddenly the Apache Web Sever in XAMPP was no longer starting. I then uninstalled Php but still had the same issue. I decided to to do a clean install of XAMPP, making a copy of my old /opt/lampp/ directory. I thought it would be enough to re-install XAMPP and copy over the /opt/lampp/htdocs and /opt/lamp/var/mysql into the newly installed XAMPP directory.
When I try to run XAMPP now Apache starts but MySQL database does not.
When I enable showing exception details in the LocalSettings.php of my Wiki and try to access via web browser I get the following error message:
MediaWiki internal error.
Original exception: [XVZpYg4zO1Jsk5cKtKVvcgAAAAM] /mywiki/ Wikimedia\Rdbms\DBConnectionError from line 1213 of /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)
Backtrace:
#0 /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(758): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /opt/lampp/htdocs/mywiki/includes/GlobalFunctions.php(2637): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)
#2 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(integer)
#3 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(410): LCStoreDB->get(string, string)
#4 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(456): LocalisationCache->isExpired(string)
#5 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(332): LocalisationCache->initLanguage(string)
#6 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(273): LocalisationCache->loadItem(string, string)
#7 /opt/lampp/htdocs/mywiki/languages/Language.php(4537): LocalisationCache->getItem(string, string)
#8 /opt/lampp/htdocs/mywiki/languages/Language.php(262): Language::getFallbacksFor(string)
#9 /opt/lampp/htdocs/mywiki/languages/Language.php(223): Language::newFromCode(string)
#10 /opt/lampp/htdocs/mywiki/includes/ServiceWiring.php(120): Language::factory(string)
#11 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(430): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#12 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(414): Wikimedia\Services\ServiceContainer->createService(string)
#13 /opt/lampp/htdocs/mywiki/includes/MediaWikiServices.php(508): Wikimedia\Services\ServiceContainer->getService(string)
#14 /opt/lampp/htdocs/mywiki/includes/Setup.php(790): MediaWiki\MediaWikiServices->getContentLanguage()
#15 /opt/lampp/htdocs/mywiki/includes/WebStart.php(77): require_once(string)
#16 /opt/lampp/htdocs/mywiki/index.php(39): require(string)
#17 {main}
Exception caught inside exception handler: [XVZpYg4zO1Jsk5cKtKVvcgAAAAM] /mywiki/ Wikimedia\Rdbms\DBConnectionError from line 1213 of /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php: Cannot access the database: Unknown error (localhost)
Backtrace:
#0 /opt/lampp/htdocs/mywiki/includes/libs/rdbms/loadbalancer/LoadBalancer.php(758): Wikimedia\Rdbms\LoadBalancer->reportConnectionError()
#1 /opt/lampp/htdocs/mywiki/includes/GlobalFunctions.php(2637): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, boolean)
#2 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LCStoreDB.php(54): wfGetDB(integer)
#3 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(355): LCStoreDB->get(string, string)
#4 /opt/lampp/htdocs/mywiki/includes/cache/localisation/LocalisationCache.php(273): LocalisationCache->loadItem(string, string)
#5 /opt/lampp/htdocs/mywiki/languages/Language.php(4537): LocalisationCache->getItem(string, string)
#6 /opt/lampp/htdocs/mywiki/languages/Language.php(262): Language::getFallbacksFor(string)
#7 /opt/lampp/htdocs/mywiki/languages/Language.php(223): Language::newFromCode(string)
#8 /opt/lampp/htdocs/mywiki/includes/ServiceWiring.php(120): Language::factory(string)
#9 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(430): Wikimedia\Services\ServiceContainer->{closure}(MediaWiki\MediaWikiServices)
#10 /opt/lampp/htdocs/mywiki/includes/libs/services/ServiceContainer.php(414): Wikimedia\Services\ServiceContainer->createService(string)
#11 /opt/lampp/htdocs/mywiki/includes/MediaWikiServices.php(508): Wikimedia\Services\ServiceContainer->getService(string)
#12 /opt/lampp/htdocs/mywiki/includes/cache/MessageCache.php(126): MediaWiki\MediaWikiServices->getContentLanguage()
#13 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionRenderer.php(311): MessageCache::singleton()
#14 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionRenderer.php(51): MWExceptionRenderer::reportOutageHTML(Wikimedia\Rdbms\DBConnectionError)
#15 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(98): MWExceptionRenderer::output(Wikimedia\Rdbms\DBConnectionError, integer)
#16 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(172): MWExceptionHandler::report(Wikimedia\Rdbms\DBConnectionError)
#17 /opt/lampp/htdocs/mywiki/includes/exception/MWExceptionHandler.php(144): MWExceptionHandler::handleException(Wikimedia\Rdbms\DBConnectionError)
#18 [internal function]: MWExceptionHandler::handleUncaughtException(Wikimedia\Rdbms\DBConnectionError)
#19 {main}
Is there anyway I can recover this?
So after spending a bit of time messing around trying various things I found a solution that allowed me to recover the Wiki. I'll post what I did here in case it helps anyone in the future. It involves the following steps:
Exporting the tables of the MySQL Mediawiki database
Clean installing XAMPP
Clean install Mediawiki and create a new wiki project
Deleting the MySQL database of the new project
Importing old tables to new project
Since I'm a complete noob with regards to webservers/MySQL this is probably not the quickest or most efficient method but it worked.
Starting Point:
Something in your XAMPP configuration is messed up which causes MySQL Database not to start. As such phpMyAdmin can not be started from the web browser
You are reasonably confident the MediaWiki MySQL database itself is functional and exists (on XAMPP 7.3.7-1 for Ubuntu the following files should be located in the /opt/lampp/var/mysql dir: ib_logfile0, ib_logfile1 and ibdata1. There should be also be a folder in there with the name of your Mediawiki.
Solution:
1) Exporting the tables of your Mediawiki database
Make a copy of your entire /opt/lampp/ directory somewhere safe.
Uninstall XAMPP sudo ./opt/var/uninstall and remove the dir rm -rf /opt/lampp
Reinstall XAMPP (use the same version you used previously)
Copy your backed up versions of ib_logfile0, ib_logfile1 and ibdata1 into /opt/lampp/var/mysql/
From your backup copy the entire folder backup/lampp/var/mysql/mywiki into the newly install XAMPP dir /opt/lampp/var/mysql/
Start XAMPP - everything should work. Go to phpMyAdmin and you should see the database of your wiki. Go to it and export it as SQL format. Save the .sql file.
2) Clean install XAMPP once again (delete everything in opt/lampp)
3) Follow the instructions to install MediaWiki with XAMPP
4) Do the swap
As per step 3) you should now have a clean Mediawiki install with a brand new wiki linked to a new database.
Go to phpMyAdmin, select database and then "check all" tables in the database and delete (drop) them.
Now have an empty database. In phpMyAdmin click Import and upload your .sql file generated from step 1).
Try starting XAMPP and (hopefully) load the wiki!
Whenever I try to access my app online I get the following error.
[the-domain] is currently unable to handle this request.
I'm currently lost and don't even know what the problem is I've replicated my local environment on my server and the problem still persists, probably something I'm missing.
Here is my current config.
Laravel 5.7
PHP 7.2.9
Heres the stack trace form laravel.log:
[2018-09-30 12:18:28] staging.ERROR: syntax error, unexpected '|', expecting variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\F$
[stacktrace]
#0 /var/www/avanzi/vendor/composer/ClassLoader.php(322): Composer\\Autoload\\includeFile('/var/www/invite...')
#1 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('Illuminate\\\\Supp...')
#2 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(22): spl_autoload_call('Illuminate\\\\Supp...')
#3 /var/www/avanzi/vendor/composer/ClassLoader.php(444): include('/var/www/invite...')
#4 /var/www/avanzi/vendor/composer/ClassLoader.php(322): Composer\\Autoload\\includeFile('/var/www/invite...')
#5 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('Illuminate\\\\Data...')
#6 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php(35): spl_autoload_call('Illuminate\\\\Data...')
#7 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(572): Illuminate\\Database\\DatabaseServiceProvider->register()
#8 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(75): Illuminate\\Foundation\\Application->register(Object(Illumin$
#9 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(548): Illuminate\\Foundation\\ProviderRepository->load(Array)
#10 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfi$
#11 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(206): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(O$
#12 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#13 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#14 /var/www/avanzi/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Ob$
#15 /var/www/avanzi/public/index.php(58): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#16 {main}
"}
NB: This works perfectly fine in my local environment with the same PHP and Laravel version.
So I finally got it figured out for my use case.
I had the right PHP version installed but haven't enabled the extensions required by Laravel yet, so to fix this I had to go to the php.ini file for my currently installed and active PHP version and enable those extensions, here is a list of the required PHP extensions for a Laravel 5.7 project.
PHP >= 7.1.3
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension
With all these extensions installed your PHP configuration should be good to go.
I have configured the cookieValidationKey inside my backend\config\main.php and frontend\config\main.php and removed it from common\config\main.php. But when I run php yii inside command line. I get this error.
Even before I set it inside to my backend config the error showed up when I used the command line.
$ php yii
Exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\Request:
:cookieValidationKey'
in D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Component.php:201
Stack trace:
#0 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\BaseYii.php(525): yii\base\Component->__set('cook
ieValidatio...', '9H2hvsco52yQ0N2...')
#1 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Obje
ct(yii\console\Request), Array)
#2 [internal function]: yii\base\Object->__construct(Array)
#3 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\Container.php(381): ReflectionClass->newInstan
ceArgs(Array)
#4 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\Container.php(156): yii\di\Container->build('y
ii\\console\\Req...', Array, Array)
#5 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('yii\\con
sole\\Req...', Array, Array)
#6 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\di\ServiceLocator.php(135): yii\BaseYii::createOb
ject(Array)
#7 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\console\Application.php(219): yii\di\ServiceLocat
or->get('request')
#8 D:\web\wamp64\www\html\royall.dev\vendor\yiisoft\yii2\base\Application.php(380): yii\console\Applicatio
n->getRequest()
#9 D:\web\wamp64\www\html\royall.dev\yii(27): yii\base\Application->run()
#10 {main}
Why is this happening? I did not have cookieValidationKey inside my console\config\main.php so it should not Popup this error.
I use windows and wamp-server but I tested it on an Ubuntu server and it's returning the same error.
That's because your console command combined all configs before executing the actual action. There are some config params which are invalid to console actions but useful to web requests. The solution is to remove these params before executing console actions.
Add the following line
unset($config['components']['request']);
before
$application = new yii\console\Application($config);
in file yii.
Because I run web server via vagrant, I didn't test if there's side effect to web app run via yii command.
I am running php 5.5 on a Windows Server 2008. I am using the Laravel 4.0 framework for the application. I am connecting to a SQL SRV database via PDO, when executed via http there is no issue, connections are made data is called and updated without issue.
However when calling a command from Artisan (Laravel's CLI tool) I get the following error in the log:
log.ERROR: exception 'PDOException' with message 'could not find driver' in C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:47
Stack trace:
#0 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php(47): PDO->__construct('sqlsrv:Server=H...', 'xxxxxx', 'xxxxxx', Array)
#1 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServerConnector.php(29): Illuminate\Database\Connectors\Connector->createConnection('sqlsrv:Server=H...', Array, Array)
#2 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(41): Illuminate\Database\Connectors\SqlServerConnector->connect(Array)
#3 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(128): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'sqlsrv')
#4 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(64): Illuminate\Database\DatabaseManager->makeConnection('sqlsrv')
#5 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(242): Illuminate\Database\DatabaseManager->connection()
#6 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(206): Illuminate\Database\DatabaseManager->__call('table', Array)
#7 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(206): Illuminate\Database\DatabaseManager->table('bb_job_details')
#8 C:\inetpub\MBSWeb\postsrch\app\models\Job.php(214): Illuminate\Support\Facades\Facade::__callStatic('table', Array)
#9 C:\inetpub\MBSWeb\postsrch\app\models\Job.php(214): Illuminate\Support\Facades\DB::table('bb_job_details')
#10 C:\inetpub\MBSWeb\postsrch\app\models\Cron.php(18): Job::getJobDetailsByStatus()
#11 C:\inetpub\MBSWeb\postsrch\app\controllers\ApplicantController.php(14): Cron::ChangePostingJobStatus()
#12 C:\inetpub\MBSWeb\postsrch\app\commands\GetApplicantsCommand.php(45): ApplicantController->index()
#13 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Console\Command.php(108): GetApplicantsCommand->fire()
#14 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Command\Command.php(244): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 C:\inetpub\MBSWeb\postsrch\vendor\laravel\framework\src\Illuminate\Console\Command.php(96): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(897): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(191): Symfony\Component\Console\Application->doRunCommand(Object(GetApplicantsCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php(121): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 C:\inetpub\MBSWeb\postsrch\artisan(59): Symfony\Component\Console\Application->run()
#20 {main} [] []
[2014-03-23 22:53:13] log.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Call to undefined function Symfony\Component\Console\mb_detect_encoding()' in C:\inetpub\MBSWeb\postsrch\vendor\symfony\console\Symfony\Component\Console\Application.php:721
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
The PDO SQLSRV lib is installed, see the below screenshot of the phpinfo(), and as I've already said I can connection without issue when using the application via http;
Why is the PDO connection working fine via http but not in CLI? Please note I'm using the exact same set of code, one is called from a Laravel controller, the other from a Laravel command.
php cli and php cgi use different php.ini files. Try php -i | grep pdo to see if pdo is installed for your cli, see php -i | grep "Loaded Configuration File"
The answer above is correct, but just to clarify:
Open your console and execute:
php -i | grep "Loaded Configuration File"
That will give you the folder directory where you php-cli.ini is (Laravel Commands use a different php.ini than the one used by HTTP requests)
Go to that file, and make sure it has this:
extension=php_pdo_mysql.dll
Restart your server and try again. That worked for me, hope it helps.