Cannot log into Magento 1.8.1 admin - php

I have just recently installed Magento 1.8.1 on a LAMP environment. Upon my first attempt to login to the admin area I got an error message. This is what I found in the error in var/report:
a:5:{i:0;s:24:"Currency 'GBP' not found";i:1;s:3536:"#0 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Locale.php(587): Zend_Currency->__construct('GBP')
#1 /home/dlsb/public_html/app/code/core/Mage/Directory/Model/Currency.php(270): Mage_Core_Model_Locale->currency('GBP')
#2 /home/dlsb/public_html/app/code/core/Mage/Directory/Model/Currency.php(242): Mage_Directory_Model_Currency->formatTxt(NULL, Array)
#3 /home/dlsb/public_html/app/code/core/Mage/Directory/Model/Currency.php(222): Mage_Directory_Model_Currency->formatPrecision(NULL, 2, Array, true, false)
#4 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php(82): Mage_Directory_Model_Currency->format(NULL)
#5 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/Block/Dashboard/Bar.php(62): Mage_Adminhtml_Block_Dashboard_Bar->format(NULL)
#6 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/Block/Dashboard/Totals.php(74): Mage_Adminhtml_Block_Dashboard_Bar->addTotal('Revenue', NULL)
#7 /home/dlsb/public_html/app/code/core/Mage/Core/Block/Abstract.php(293): Mage_Adminhtml_Block_Dashboard_Totals->_prepareLayout()
#8 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#9 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/Block/Dashboard.php(50): Mage_Core_Model_Layout->createBlock('adminhtml/dashb...')
#10 /home/dlsb/public_html/app/code/core/Mage/Core/Block/Abstract.php(293): Mage_Adminhtml_Block_Dashboard->_prepareLayout()
#11 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(456): Mage_Core_Block_Abstract->setLayout(Object(Mage_Core_Model_Layout))
#12 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('adminhtml/dashb...', 'dashboard')
#13 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('adminhtml/dashb...', 'dashboard')
#14 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#15 /home/dlsb/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#16 /home/dlsb/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#17 /home/dlsb/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#18 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/Controller/Action.php(275): Mage_Core_Controller_Varien_Action->loadLayout(NULL, true, true)
#19 /home/dlsb/public_html/app/code/core/Mage/Adminhtml/controllers/DashboardController.php(40): Mage_Adminhtml_Controller_Action->loadLayout()
#20 /home/dlsb/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_DashboardController->indexAction()
#21 /home/dlsb/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#22 /home/dlsb/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#23 /home/dlsb/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#24 /home/dlsb/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#25 /home/dlsb/public_html/index.php(87): Mage::run('', 'store')
#26 {main}";s:3:"url";s:70:"/index.php/admin/dashboard/index/key/6dafbe1266347635735b10354e511cc5/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:5:"admin";}
After a bit of Googling I read a few posts advising to delete data from:
var/cache
var/session
var/locks
var/report
and to restart apache then to clear the browser cache. After doing all of this the issue still persists. Please help.

Open this file > app/code/core/Mage/Core/Model/Session/Abstract/Varien.php
go to line 88 [in my app]
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
'domain' => $cookie->getConfigDomain(),
'secure' => $cookie->isSecure(),
'httponly' => $cookie->getHttponly()
);
Comment the lines as shown below
$cookieParams = array(
'lifetime' => $cookie->getLifetime(),
'path' => $cookie->getPath()
//'domain' => $cookie->getConfigDomain(),
//'secure' => $cookie->isSecure(),
//'httponly' => $cookie->getHttponly()
);

Related

Log::info in another file with laravel using channel

I have a Job that runs each 10 minutes, and is flooding the laravel.log, so I want to log all his activity to /storage/logs/customJob.log
In /config/logging.php, I added a channel:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
// ...
'customJob' => [
'driver' => 'single',
'path' => storage_path('logs/customJob.log'),
'level' => 'info',
]
],
and call it in my job with
Log::channel('customJob')->info("test...");
Weird thing is when I try it with tinker or locally, it works well.
But in production, I can see:
in logs/customJob.log, I can see the logs for 10:30, 11:40, 12:10, seems random.
in logs/laravel.log, I can see:
[2021-05-19 12:40:25] laravel.EMERGENCY: Unable to create configured
logger. Using emergency logger. {"exception":"[object]
(ErrorException(code: 0): Undefined array key \"driver\" at
/home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:195)
[stacktrace]
#0 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(195):
Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(118):
Illuminate\\Log\\LogManager->resolve()
#2 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(98):
Illuminate\\Log\\LogManager->get()
#3 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Log/LogManager.php(87):
Illuminate\\Log\\LogManager->driver()
#4 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261):
Illuminate\\Log\\LogManager->channel()
#5 /home/ubuntu/project/app/Jobs/BlockchainToDb.php(104): Illuminate\\Support\\Facades\\Facade::__callStatic()
#6 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
App\\Jobs\\BlockchainToDb->handle()
#7 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#8 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#9 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#10 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#11 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128):
Illuminate\\Container\\Container->call()
#12 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#13 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#14 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132):
Illuminate\\Pipeline\\Pipeline->then()
#15 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118):
Illuminate\\Bus\\Dispatcher->dispatchNow()
#16 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128):
Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#17 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103):
Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#18 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120):
Illuminate\\Pipeline\\Pipeline->then()
#19 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70):
Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#20 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98):
Illuminate\\Queue\\CallQueuedHandler->call()
#21 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(410):
Illuminate\\Queue\\Jobs\\Job->fire()
#22 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360):
Illuminate\\Queue\\Worker->process()
#23 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158):
Illuminate\\Queue\\Worker->runJob()
#24 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117):
Illuminate\\Queue\\Worker->daemon()
#25 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101):
Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#26 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
Illuminate\\Queue\\Console\\WorkCommand->handle()
#27 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Util.php(40):
Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#28 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\\Container\\Util::unwrapIfClosure()
#29 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\\Container\\BoundMethod::callBoundMethod()
#30 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Container/Container.php(611):
Illuminate\\Container\\BoundMethod::call()
#31 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(136):
Illuminate\\Container\\Container->call()
#32 /home/ubuntu/project/vendor/symfony/console/Command/Command.php(256):
Illuminate\\Console\\Command->execute()
#33 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Command.php(121):
Symfony\\Component\\Console\\Command\\Command->run()
#34 /home/ubuntu/project/vendor/symfony/console/Application.php(971):
Illuminate\\Console\\Command->run()
#35 /home/ubuntu/project/vendor/symfony/console/Application.php(290):
Symfony\\Component\\Console\\Application->doRunCommand()
#36 /home/ubuntu/project/vendor/symfony/console/Application.php(166):
Symfony\\Component\\Console\\Application->doRun()
#37 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Console/Application.php(92):
Symfony\\Component\\Console\\Application->run()
#38 /home/ubuntu/project/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129):
Illuminate\\Console\\Application->run()
#39 /home/ubuntu/project/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#40 {main} "}
I can see those warning for all the missing timestamps in customJob.log ie 10:40, 10:50, 11:00, 11:10, 11:20, 11:30, 11:50, etc.
Where BlockchainToDb.php(104) correspond to:
Log::channel('customJob')->info("Skipping...");
I also took care of cleaning cache, config, views and route in production:
php artisan cache:clear
php artisan config:clear
php artisan view:clear
php artisan route:clear
Why is it behaving this way ???

Error include(php.php): failed to open stream: No such file or directory Yii Version 1.1.22 + S3

I'm trying to put/get an s3 object using Yii 1.1.22 and AWS PHP v3 , and when I try to upload an image to s3 I'm getting below error :
include(php.php): failed to open stream: No such file or directory
stack trace
[error] [php] include(php.php): failed to open stream: No such file or directory (/xxxx/framework/yii/framework/YiiBase.php:463)
yii stack trace:
#0 unknown(0): spl_autoload_call()
#1 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(151): method_exists()
#2 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(113): GuzzleHttp\Promise\Promise->settle()
#3 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(203): GuzzleHttp\Promise\Promise->resolve()
#4 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(156): callHandler()
#5 /xxxx/vendors/aws/GuzzleHttp/Promise/TaskQueue.php(47): GuzzleHttp\Promise\{closure}()
#6 /xxxx/vendors/aws/GuzzleHttp/Handler/CurlMultiHandler.php(96): GuzzleHttp\Promise\TaskQueue->run()
#7 /xxxx/vendors/aws/GuzzleHttp/Handler/CurlMultiHandler.php(123): GuzzleHttp\Handler\CurlMultiHandler->tick()
#8 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(246): GuzzleHttp\Handler\CurlMultiHandler->execute()
#9 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#10 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#12 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#13 /xxxx/vendors/aws/GuzzleHttp/Promise/Coroutine.php(65): GuzzleHttp\Promise\Promise->wait()
#14 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(246): GuzzleHttp\Promise\Coroutine->GuzzleHttp\Promise\{closure}()
#15 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#16 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#17 /xxxx/vendors/aws/GuzzleHttp/Promise/Coroutine.php(85): GuzzleHttp\Promise\Promise->wait()
#18 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(273): GuzzleHttp\Promise\Coroutine->wait()
#19 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#20 /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#21 /xxxx/vendors/aws/Aws/AwsClientTrait.php(59): GuzzleHttp\Promise\Promise->wait()
#22 /xxxx/vendors/aws/Aws/AwsClientTrait.php(78): Aws\S3\S3Client->execute()
#23 /xxxx/protected/extensions/s3/ES3.php(125): Aws\S3\S3Client->__call()
#24 /xxxx/protected/components/Uploader.php(97): ES3->upload()
#25 /xxxx/protected/modules/account/controllers/UserController.php(619): Uploader->upload()
#26 /xxxx/protected/modules/account/controllers/UserController.php(411): UserController->saveUser()
#27 /xxxx/framework/yii/framework/web/actions/CInlineAction.php(49): UserController->actionEditUser()
#28 /xxxx/framework/yii/framework/web/CController.php(308): CInlineAction->runWithParams()
#29 /xxxx/framework/yii/framework/web/CController.php(286): UserController->runAction()
#30 /xxxx/framework/yii/framework/web/CController.php(265): UserController->runActionWithFilters()
#31 /xxxx/framework/yii/framework/web/CWebApplication.php(282): UserController->run()
#32 /xxxx/framework/yii/framework/web/CWebApplication.php(141): CWebApplication->runController()
#33 /xxxx/framework/yii/framework/base/CApplication.php(185): CWebApplication->processRequest()
#34 /xxxx/index.php(36): CWebApplication->run()
REQUEST_URI=/_pfpg_CVWaHvEhl-5MEij5PiF9oCmnFPK6yNHIX7sqetYnfGY_vcsum=b4b2ef23eeb23074c51a8c6631b491861541198cd0ea11492713cb2cd6bfce10
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (151)
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (113)
in /xxxx/vendors/aws/GuzzleHttp/Promise/Promise.php (203)
I'm using below code to upload :
$result = $s3->putObject([
'Bucket' => '',
'Key' => 'ogo_1070.png ',
]);
and my s3 config is :
$arrS3Config = [
'region' => ( getenv('APPLICATION_ENV') == 'dr' ) ? 'eu-central-1' : 'us-east-1',
'version' => '2006-03-01',
];
Can any one help me how trace this error at least
Thanks

swiftmailer and Yii2 not working 1 out of 10 time

I have a background process sending email to me when specific event occur.
It's working most of the time (9 out of 10), but sometime I get the following error message :
PHP Warning 'yii\base\ErrorException' with message 'fwrite(): SSL: An established connection was aborted by the software in your host machine.'
in E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php:232
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleError(2, 'fwrite(): SSL: ...', 'E:\ProgramData\...', 232, Array)
#1 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php(232): fwrite(Resource id #481, 'MAIL FROM:<MTE#...')
#2 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\ByteStream\AbstractFilterableInputStream.php(171): Swift_Transport_StreamBuffer->_commit('MAIL FROM:<MTE#...')
#3 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\ByteStream\AbstractFilterableInputStream.php(90): Swift_ByteStream_AbstractFilterableInputStream->_doWrite('MAIL FROM:<MTE#...')
#4 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(276): Swift_ByteStream_AbstractFilterableInputStream->write('MAIL FROM:<MTE#...')
#5 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\EsmtpTransport.php(243): Swift_Transport_AbstractSmtpTransport->executeCommand('MAIL FROM:<MTE#...', Array, Array)
#6 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\EsmtpTransport.php(322): Swift_Transport_EsmtpTransport->executeCommand('MAIL FROM:<MTE#...', Array)
#7 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(416): Swift_Transport_EsmtpTransport->_doMailFromCommand('MTE#...')
#8 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(444): Swift_Transport_AbstractSmtpTransport->_doMailTransaction(Object(Swift_Message), 'MTE#...', Array, Array)
#9 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php(176): Swift_Transport_AbstractSmtpTransport->_sendTo(Object(Swift_Message), 'MTE#...', Array, Array)
#10 E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Mailer.php(85): Swift_Transport_AbstractSmtpTransport->send(Object(Swift_Message), Array)
#11 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2-swiftmailer\Mailer.php(146): Swift_Mailer->send(Object(Swift_Message))
#12 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\mail\BaseMailer.php(260): yii\swiftmailer\Mailer->sendMessage(Object(yii\swiftmailer\Message))
#13 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\mail\BaseMessage.php(48): yii\mail\BaseMailer->send(Object(yii\swiftmailer\Message))
#14 E:\ProgramData\htdocs\Yii2_KB\controllers\BackgroundTask.php(172): yii\mail\BaseMessage->send()
#15 E:\ProgramData\htdocs\Yii2_KB\vendor\bazilio\yii2-async\commands\AsyncWorkerCommand.php(29): app\controllers\BackgroundTask->execute()
#16 [internal function]: bazilio\async\commands\AsyncWorkerCommand->actionDaemon('background')
#17 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#18 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\base\Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#19 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\console\Controller.php(91): yii\base\Controller->runAction('daemon', Array)
#20 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\base\Module.php(455): yii\console\Controller->runAction('daemon', Array)
#21 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\console\Application.php(167): yii\base\Module->runAction('async-worker/da...', Array)
#22 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\console\Application.php(143): yii\console\Application->runAction('async-worker/da...', Array)
#23 E:\ProgramData\htdocs\Yii2_KB\vendor\yiisoft\yii2\base\Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#24 E:\ProgramData\htdocs\Yii2_KB\yii(23): yii\base\Application->run()
#25 {main}
PHP Warning: fwrite(): SSL operation failed with code 1. OpenSSL Error messages:
error:1409F07F:SSL routines:SSL3_WRITE_PENDING:bad write retry in E:\ProgramData\htdocs\Yii2_KB\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\StreamBuffer.php on line 232
Here follow my configuration for the mailer :
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'x.x.x.xxx',
'username' => 'xxx',
'password' => 'XyXyXy',
'port' => '25',
'encryption' => 'tls',
],
],
I'm using Yii 2.0.6
PHP Version : 5.5.9
Mail server : Exchange Server 2010
When it fail, it's mostly after a period of inactivity between 2 events ( a few hours).
Any ideas ?
Thanks to ineersa for the tips.
I've added the following code in the beginning of the background process, and now it's working.
if (Yii::$app->mailer->getTransport()->isStarted()) {
Yii::$app->mailer->getTransport()->stop();
}
Yii::$app->mailer->getTransport()->start();

Laravel 4 Paypal IPN Not Working TokenMismatchException

I am simply adding a paypal IPN (using the https://github.com/mike182uk/paypal-ipn-listener) to add credits to a users profile and add the order into the database. I actually had this working, but for some reason a day later, I noticed nothing being inserted into the DB and the users credits are not given. All I get in the laravel.log is this huge error log which seems to be all TokenMismatchException.
FYI: I am using the paypal sandbox to do this right now, so not sure if that matters or not, but it's quite slow in responding.
Full error log for that specific call:
[2015-01-12 00:21:15] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:21:26] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:21:46] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
[2015-01-12 00:22:10] production.ERROR: exception 'Illuminate\Session\TokenMismatchException' in /home/username/webapps/site_name/app/filters.php:88
Stack trace:
#0 [internal function]: {closure}(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#1 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(199): call_user_func_array(Object(Closure), Array)
#2 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(154): Illuminate\Events\Dispatcher->fire('router.filter: ...', Array, true)
#3 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1468): Illuminate\Events\Dispatcher->until('router.filter: ...', Array)
#4 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(240): Illuminate\Routing\Router->callRouteFilter('csrf', Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#5 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Routing\ControllerDispatcher->callFilter(Array, Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#6 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(55): Illuminate\Routing\ControllerDispatcher->before(Object(AuthController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'postLogin')
#7 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(962): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'AuthController', 'postLogin')
#8 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#9 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)
#10 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1028): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#11 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Routing/Router.php(996): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#13 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#14 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#15 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#16 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#17 /home/username/webapps/site_name/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#18 /home/username/webapps/site_name/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#19 /home/username/webapps/site_name/public/index.php(49): Illuminate\Foundation\Application->run()
#20 {main} [] []
Not even sure what TokenMismatchException has to do with the Paypal IPN since I don't have csrf enabled on the routes for it. Peep the Controller/routes below:
IpnController
use PayPal\Ipn\Listener;
use PayPal\Ipn\Message;
use PayPal\Ipn\Verifier\CurlVerifier;
class IpnController extends BaseController {
/**
* Store a newly created resource in storage.
*
* #return Response
*/
public function store()
{
$listener = new Listener;
$verifier = new CurlVerifier;
$ipnMessage = Message::createFromGlobals(); // uses php://input
$verifier->setIpnMessage($ipnMessage);
if ( Config::get( 'app.debug' ) ) {
$verifier->setEnvironment('sandbox'); // Use sandbox if debug is true
} else {
$verifier->setEnvironment('production');
}
$listener->setVerifier($verifier);
$listener->listen( function() use ( $listener )
{
// on verified IPN (everything is good!)
$resp = $listener->getVerifier()->getVerificationResponse();
$data = Input::all();
$order = new CreditOrder;
$order->txn_id = $data['txn_id'];
$order->payer_email = $data['payer_email'];
$order->user_id = $data['custom'];
$order->product_id = $data['item_number'];
$order->mc_gross = $data['mc_gross'];
$order->save();
$product = Product::find( $data['item_number'] );
$user = User::find( $data['custom'] );
$user->increment( 'credits', $product->credit_amount );
Mail::send( 'emails.credits.thankyou', [ 'username' => $user->username, 'package' => $product->product, 'credits' => $product->credit_amount, 'price' => $product->price ], function( $message ) {
$message->to( 'email#gmail.com', 'Name' )->subject( 'Name - Credits Added!' );
});
},
function() use ( $listener )
{
// on invalid IPN (somethings not right!)
$report = $listener->getReport();
$resp = $listener->getVerifier()->getVerificationResponse();
Log::error('invalid IPN');
Mail::send( 'emails.plain', [ 'content' => $report ], function( $message ) {
$message->to( 'email#gmail.com', 'Name' )->subject( 'Name Invalid IPN' );
});
});
}
public function cancel()
{
return Redirect::route( 'credits.packages' )->with( 'error', 'Your payment was canceled.' );
}
public function success()
{
return View::make( 'credits.success' );
// return Redirect::home()->with( 'success', '<strong>Thank you, '. Auth::user()->username .'!</strong> Your payment was successful and your account has been credited.' );
}
}
IPN Routes
Route::group( [ 'before' => 'auth' ], function()
{
// IPN
Route::post('/credits/ipn', [ 'uses' => 'IpnController#store', 'as' => 'credits.ipn' ] );
Route::get('/credits/cancel', [ 'uses' => 'IpnController#cancel', 'as' => 'credits.cancel' ] );
Route::post('/credits/success', [ 'uses' => 'IpnController#success', 'as' => 'credits.success' ] );
});
If you need me to add any additional info, please let me know. I've been struggling with this for a few days now and really need to get this figured out this week! Appreciate any help :)
Just by taking my IPN routes out of the "before auth" group, it seems to be working fine now?
Someone did mention something about the csrf being enabled by default on post routes. So that could have something to do with it as well. Just in case, I used their suggestion here:
http://laravel.io/forum/01-12-2015-laravel-4-paypal-ipn-not-working-tokenmismatchexception?page=1#reply-19578
All seems to be working now though.
Cheers!

Zend framework 2 : " Connect Error: SQLSTATE[28000] [1045] Access denied"

I have been working on the official tutorial for ZF2.
At the end of the page, to see what gives the result, I get this long error:
An error occurred
An error occurred during execution; please try again later.
Additional information:
Zend\Db\Adapter\Exception\RuntimeException
File:
D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Connection.php:243
Message:
Connect Error: SQLSTATE[28000] [1045] Access denied for user ''#'localhost' (using password: NO)
Stack trace:
#0 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Pdo.php(211): Zend\Db\Adapter\Driver\Pdo\Connection->connect()
#1 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Adapter.php(175): Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement(NULL)
#2 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Sql\Sql.php(103): Zend\Db\Adapter\Adapter->createStatement()
#3 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(234): Zend\Db\Sql\Sql->prepareStatementForSqlObject(Object(Zend\Db\Sql\Select))
#4 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(210): Zend\Db\TableGateway\AbstractTableGateway->executeSelect(Object(Zend\Db\Sql\Select))
#5 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(197): Zend\Db\TableGateway\AbstractTableGateway->selectWith(Object(Zend\Db\Sql\Select))
#6 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\module\Album\src\Album\Model\AlbumTable.php(24): Zend\Db\TableGateway\AbstractTableGateway->select()
#7 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\module\Album\src\Album\Controller\AlbumController.php(18): Album\Model\AlbumTable->fetchAll()
#8 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(87): Album\Controller\AlbumController->indexAction()
#9 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#10 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(469): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#11 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(209): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php(108): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#14 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#15 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(469): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#16 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(209): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#17 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(298): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\public\index.php(12): Zend\Mvc\Application->run()
#19 {main}
Previous exceptions:
PDOException
File:
D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Connection.php:239
Message:
SQLSTATE[28000] [1045] Access denied for user ''#'localhost' (using password: NO)
Stack trace:
#0 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Connection.php(239): PDO->__construct('mysql:dbname=zf...', NULL, NULL, Array)
#1 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Driver\Pdo\Pdo.php(211): Zend\Db\Adapter\Driver\Pdo\Connection->connect()
#2 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Adapter\Adapter.php(175): Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement(NULL)
#3 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\Sql\Sql.php(103): Zend\Db\Adapter\Adapter->createStatement()
#4 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(234): Zend\Db\Sql\Sql->prepareStatementForSqlObject(Object(Zend\Db\Sql\Select))
#5 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(210): Zend\Db\TableGateway\AbstractTableGateway->executeSelect(Object(Zend\Db\Sql\Select))
#6 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Db\TableGateway\AbstractTableGateway.php(197): Zend\Db\TableGateway\AbstractTableGateway->selectWith(Object(Zend\Db\Sql\Select))
#7 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\module\Album\src\Album\Model\AlbumTable.php(24): Zend\Db\TableGateway\AbstractTableGateway->select()
#8 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\module\Album\src\Album\Controller\AlbumController.php(18): Album\Model\AlbumTable->fetchAll()
#9 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(87): Album\Controller\AlbumController->indexAction()
#10 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#11 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(469): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#12 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(209): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php(108): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#15 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#16 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(469): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#17 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(209): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(298): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#19 D:\softs\UwAmp\www\zf2-tutorial\ZendSkeletonApplication\public\index.php(12): Zend\Mvc\Application->run()
#20 {main}
Can anyone help me on this?
You need put your credentials in a local config file
// config/autoload/local.php:
return array(
'db' => array(
'username' => 'YOUR USERNAME HERE',
'password' => 'YOUR PASSWORD HERE',
),
);
Thank Maks3w, I got the same error because I didn't create local.php file to add the code. I thought that local.php.dist works well.
Everything's great after I have the local.php with the code
// config/autoload/local.php:
return array(
'db' => array(
'username' => 'YOUR USERNAME HERE',
'password' => 'YOUR PASSWORD HERE',
),
);
There is a comment in local.php.dist that helped me to fix it:
// Copy this file without the .dist extension at the end and populate values as needed.

Categories