edit 2 : Fixed it myself, see comments.
I am trying to access my Zf2 app via the terminal.
The idea is that a cron script will call the app on a regular basis, and a corresponding action will look for things in the database and update when needed.
When accessing the controller/action via the browser, everything's fine.
When accessing it via the terminal, I'm getting a mysql-related error and I'm a bit lost with it.
Warning: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock)
The command from the terminal is :
php index.php stories update
Here is my route :
'console' => array(
'router' => array(
'routes' => array(
'updatestories' => array(
'options' => array(
'route' => 'stories update',
'defaults' => array(
'controller' => 'Application\Controller\Index',
'action' => 'updatestories'
)
)
)
)
)
),
The action 'updatestories' is :
public function updatestoriesAction(){
$request = $this->getRequest();
// Make sure that we are running in a console and the user has not tricked our
// application into running this action from a public web server.
if (!$request instanceof ConsoleRequest){
throw new \RuntimeException('You can only use this action from a console!');
}
$talents = $this->getStoriesTable()->fetchAll();
var_dump($talents);
return "end of script. !\n";
}
And here's the error I get only when reaching it via the terminal:
Warning: PDO::__construct(): [2002] No such file or directory (trying
to connect via unix:///var/mysql/mysql.sock) in
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Connection.php
on line 281
====================================================================== The application has thrown an exception!
====================================================================== Zend\Db\Adapter\Exception\RuntimeException Connect Error:
SQLSTATE[HY000] [2002] No such file or directory
---------------------------------------------------------------------- /Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Connection.php:289
0
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Pdo.php(244):
Zend\Db\Adapter\Driver\Pdo\Connection->connect() 1
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Sql/Sql.php(120):
Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement() 2
/Users/gregorychiche/Sites/repos/module/Talents/src/Talents/Model/StoriesTable.php(35):
Zend\Db\Sql\Sql->prepareStatementForSqlObject(Object(Zend\Db\Sql\Select))
3
/Users/gregorychiche/Sites/repos/module/Application/src/Application/Controller/IndexController.php(123):
Talents\Model\StoriesTable->fetchAll() 4
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83):
Application\Controller\IndexController->updatestoriesAction() 5
[internal function]:
Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
6
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 7
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 8
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(117):
Zend\EventManager\EventManager->trigger('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 9
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114):
Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request),
Object(Zend\Console\Response)) 10 [internal function]:
Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) 11
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 12
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 13
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(309):
Zend\EventManager\EventManager->trigger('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 14
/Users/gregorychiche/sites/repos/public/index.php(24):
Zend\Mvc\Application->run() 15 {main}
====================================================================== Previous Exception(s):
====================================================================== exception 'PDOException' with message 'SQLSTATE[HY000] [2002] No such
file or directory' in
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Connection.php:281
Stack trace: 0
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Connection.php(281):
PDO->__construct('mysql:dbname=ta...', 'root', 'root', Array) 1
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Adapter/Driver/Pdo/Pdo.php(244):
Zend\Db\Adapter\Driver\Pdo\Connection->connect() 2
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Db/Sql/Sql.php(120):
Zend\Db\Adapter\Driver\Pdo\Pdo->createStatement() 3
/Users/gregorychiche/Sites/repos/module/Talents/src/Talents/Model/StoriesTable.php(35):
Zend\Db\Sql\Sql->prepareStatementForSqlObject(Object(Zend\Db\Sql\Select))
4
/Users/gregorychiche/Sites/repos/module/Application/src/Application/Controller/IndexController.php(123):
Talents\Model\StoriesTable->fetchAll() 5
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(83):
Application\Controller\IndexController->updatestoriesAction() 6
[internal function]:
Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
7
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 8
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 9
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(117):
Zend\EventManager\EventManager->trigger('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 10
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(114):
Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request),
Object(Zend\Console\Response)) 11 [internal function]:
Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent)) 12
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468):
call_user_func(Array, Object(Zend\Mvc\MvcEvent)) 13
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207):
Zend\EventManager\EventManager->triggerListeners('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 14
/Users/gregorychiche/Sites/repos/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(309):
Zend\EventManager\EventManager->trigger('dispatch',
Object(Zend\Mvc\MvcEvent), Object(Closure)) 15
/Users/gregorychiche/sites/repos/public/index.php(24):
Zend\Mvc\Application->run()
What am I missing ? I don't understand why the code is working when accessing via browser (if I remove that but of code that throws exception obviously) but not when using terminal. I thought zf2 was taking care of all depedencies.
Thanks in advance
edit 1 : getStoriesTable() is as follow. it works mighty fine when used in browser-context
public function getStoriesTable()
{
if (!$this->storiesTable) {
$sm = $this->getServiceLocator();
$this->storiesTable = $sm->get('Talents\Model\StoriesTable');
}
return $this->storiesTable;
}
edit 2 : Fixed it myself, see comments.
Greg
Issue is mysql is not working on localhost.
In most cases change in global.php hostname to 127.0.0.1
Related
I have a couple of docker containers for my Laravel 9 app (Nginx, PHP, MySQL, PHPMyAdmin, etc). I use spatie package to backup my database.
I don't know how to set the path to the mysqldump file as it's in the docker container! I tried many different paths mentioned on the internet (e.g. 'var/lib/mysql', 'mysql/bin', 'usr/bin', etc), but none of them works!
Fortunately, when I run the following command on the server, the backup file is generated successfully, so I think the mysqldump file is in the '\usr\lib':
docker exec MY-CONTAINER-NAME /usr/bin/mysqldump -u root --password=MY-PASSWORD DATABASE-NAME > storage/app/backups/backup-test.sql
The following is my MySQL service definition that I have in my docker-compose.yml file:
mysql:
image: mysql:8.0
container_name: mysql
restart: unless-stopped
tty: true
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: {{root-passowrd}}
SERVICE_NAME: mysql
networks:
- laravel
Here is the MySQL settings in config/database.php:
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'dump' => [
'dump_binary_path' => '/usr/bin',
'use_single_transaction',
'timeout' => 60 * 5,
],
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
That would be great, if someone can help me to resolve this issue!
Here is the error I get when I run
docker compose exec php php artisan backup:run
Backup failed because The dump process failed with a none successful
exitcode. Exitcode
======== 127: Command not found
Output
======
Error Output
============ sh: 1: /usr/bin/mysqldump: not found .
#0 /var/www/vendor/spatie/db-dumper/src/DbDumper.php(178): Spatie\DbDumper\Exceptions\DumpFailed::processDidNotEndSuccessfully(Object(Symfony\Component\Process\Process))
#1 /var/www/vendor/spatie/db-dumper/src/Databases/MySql.php(143): Spatie\DbDumper\DbDumper->checkIfDumpWasSuccessFul(Object(Symfony\Component\Process\Process),
'/var/www/storag...')
#2 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(274):
Spatie\DbDumper\Databases\MySql->dumpToFile('/var/www/storag...')
#3 [internal function]: Spatie\Backup\Tasks\Backup\BackupJob->Spatie\Backup\Tasks\Backup{closure}(Object(Spatie\DbDumper\Databases\MySql),
'mysql')
#4 /var/www/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(560):
array_map(Object(Closure), Array, Array)
#5 /var/www/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(739):
Illuminate\Support\Arr::map(Array, Object(Closure))
#6 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(277):
Illuminate\Support\Collection->map(Object(Closure))
#7 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(188):
Spatie\Backup\Tasks\Backup\BackupJob->dumpDatabases()
#8 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(160):
Spatie\Backup\Tasks\Backup\BackupJob->createBackupManifest()
#9 /var/www/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(58):
Spatie\Backup\Tasks\Backup\BackupJob->run()
#10 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36):
Spatie\Backup\Commands\BackupCommand->handle()
#11 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(41):
Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#12 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93):
Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#13 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37):
Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application),
Array, Object(Closure))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(651):
Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application),
Array, Array, NULL)
#15 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(182):
Illuminate\Container\Container->call(Array)
#16 /var/www/vendor/symfony/console/Command/Command.php(312): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Illuminate\Console\OutputStyle))
#17 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(152):
Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Illuminate\Console\OutputStyle))
#18 /var/www/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(28):
Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/vendor/symfony/console/Application.php(1020): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/vendor/symfony/console/Application.php(312): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\BackupCommand),
Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(102):
Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155):
Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput),
Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 {main} Sending notification failed Backup failed because: The dump process failed with a none successful exitcode. Exitcode
======== 127: Command not found
Output
======
I use following code:
'as beforeRequest' => [
'class' => 'yii\filters\AccessControl',
'rules' => [
[
'actions' => ['login', 'forgot', 'error'], // guests can just login and nothing else
'allow' => true,
'roles' => ['?'],
],
[
'allow' => true,
'roles' => ['admin', 'access'],
],
],
],
Using this code causes following errors (if a user is logged in, but have not the role admin or access):
An Error occurred while handling another error:
yii\web\ForbiddenHttpException: Sie dürfen diese Aktion nicht durchführen. in /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/filters/AccessControl.php:154
Stack trace:
0 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/filters/AccessControl.php(137): yii\filters\AccessControl->denyAccess(Object(yii\web\User))
1 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/ActionFilter.php(75): yii\filters\AccessControl->beforeAction(Object(yii\web\ErrorAction))
2 [internal function]: yii\base\ActionFilter->beforeFilter(Object(yii\base\ActionEvent))
3 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Component.php(545): call_user_func(Array, Object(yii\base\ActionEvent))
4 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Module.php(676): yii\base\Component->trigger('beforeAction', Object(yii\base\ActionEvent))
5 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Controller.php(144): yii\base\Module->beforeAction(Object(yii\web\ErrorAction))
6 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('error', Array)
7 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/web/ErrorHandler.php(97): yii\base\Module->runAction('site/error')
8 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\web\ForbiddenHttpException))
9 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\web\ForbiddenHttpException))
10 {main}
Previous exception:
yii\web\ForbiddenHttpException: Sie dürfen diese Aktion nicht durchführen. in /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/filters/AccessControl.php:154
Stack trace:
0 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/filters/AccessControl.php(137): yii\filters\AccessControl->denyAccess(Object(yii\web\User))
1 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/ActionFilter.php(75): yii\filters\AccessControl->beforeAction(Object(yii\base\InlineAction))
2 [internal function]: yii\base\ActionFilter->beforeFilter(Object(yii\base\ActionEvent))
3 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Component.php(545): call_user_func(Array, Object(yii\base\ActionEvent))
4 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Module.php(676): yii\base\Component->trigger('beforeAction', Object(yii\base\ActionEvent))
5 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Controller.php(144): yii\base\Module->beforeAction(Object(yii\base\InlineAction))
6 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
7 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('', Array)
8 /Applications/XAMPP/xamppfiles/htdocs/cms/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request))
9 /Applications/XAMPP/xamppfiles/htdocs/cms/backend/web/index.php(17): yii\base\Application->run()
10 {main}
If I use ['#'] instead of ['admin', 'access'] it works fine. That means that site/error is rendering probably.
But using ['admin, 'access'] causes errors (in text form) and site/error is NOT rendering probably. Why?
admin is a defined rule and access is a permission. Everything works great using in controllers.
Does anyone have an idea what's wrong here?
Thank you!
It seems that you have an error and the application try to show the error page. But the user don't have access to the error page too.
When I click on the Preferences link in our local MediaWiki (1.26.3), hosted on CentOS, I receive the following error:
Internal error
[fbd0dcc9] /index.php/Special:Preferences MWException from line 149 of /var/www/mediawiki-1.26.3/includes/Preferences.php: Global default '' is invalid for field stubthreshold
Backtrace:
#0 /var/www/mediawiki-1.26.3/includes/Preferences.php(101): Preferences::loadPreferenceValues(User, RequestContext, array)
#1 /var/www/mediawiki-1.26.3/includes/Preferences.php(1264): Preferences::getPreferences(User, RequestContext)
#2 /var/www/mediawiki-1.26.3/includes/specials/SpecialPreferences.php(67): Preferences::getFormObject(User, RequestContext)
#3 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPage.php(384): SpecialPreferences->execute(NULL)
#4 /var/www/mediawiki-1.26.3/includes/specialpage/SpecialPageFactory.php(553): SpecialPage->run(NULL)
#5 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(281): SpecialPageFactory::executePath(Title, RequestContext)
#6 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(714): MediaWiki->performRequest()
#7 /var/www/mediawiki-1.26.3/includes/MediaWiki.php(508): MediaWiki->main()
#8 /var/www/mediawiki-1.26.3/index.php(41): MediaWiki->run()
#9 {main}
Any assistance to resolve the issue is appreciated.
This error can appear for a number of reasons, but the most common is probably an invalid or missing value in $wgDefaultUserOptions in LocalSettings.php.
Default user settings can be changed like this:
$wgDefaultUserOptions['editsection'] = 0;
However, if you add something like this:
$wgDefaultUserOptions = array( 'editsection' => 0, 'watchdefault' => 1, 'watchmoves' => 1, ... );
while everything might seem to work just fine, as you have now overwritten the whole default array, you risk running into an error the next time a new user setting is added in the software, on a MediaWiki upgrade.
The error can also occur because of an extension that uses the UserGetDefaultOptions hook to modify default settings, or because one of the values given in $wgDefaultUserOptions is simply invalid.
When I enter command yii or test/codeception/bin/yii migrate in the console, receive such a message
Fatal error: Uncaught exception 'yii\base\UnknownPropertyException' with message 'Setting unknown property: yii\console\ErrorHandler::errorAction' in D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\base\Component.php:197
Stack trace:
#0 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\BaseYii.php(518): yii\base\Component->__set('errorAction', 'site/error')
#1 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\base\Object.php(105): yii\BaseYii::configure(Object(yii\console\ErrorHandler), Array)
#2 [internal function]: yii\base\Object->__construct(Array)
#3 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\di\Container.php(372): ReflectionClass->newInstanceArgs(Array)
#4 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\di\Container.php(151): yii\di\Container->build('yii\\console\\Err...', Array, Array)
#5 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\BaseYii.php(344): yii\di\Container->get('yii\\console\\Err...', Array, Array)
#6 D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\di\ServiceLocator.php(13 in D:\Desktop\loalhost\yii2-wiersz\vendor\yiisoft\yii2\base\Component.php on line 197
console/config/main.php is default. Problem is on localhost (win7x62) and remote host (debian).
I had the same situation with the attempt to migrate rbac
(yii migrate --migrationPath=#yii/rbac/migrations)
What is causing the problem ??? my ignorance ;)?
Well, as you error message says, you are trying to set unknown property 'errorAction'. I suppose you are using the same error component config here in console app as in web app. See if there is
[
'components' => [
'error' => [
'errorAction' => ...
]
]
]
in your console app config. There shouldn't be 'errorAction'.
Thanks,
I moved from frontend/config and backend/config code
'errorHandler' => [
'errorAction' => 'site/error',
]
to common/config. Frontend and backend app did not have a problem with that, but console yes. After rollback is ok.
I'm trying to set up an application using the Zend Framework but the problem i'm getting is as soon as i add the following line in the application.ini the default home page that is created by the zend tool throws a fatal error
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with
message 'Configuration array must have a key for 'password' for login
credentials' in C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php:295
Stack trace: #0 C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php(183):
Zend_Db_Adapter_Abstract->_checkRequiredOptions(Array) #1
C:\xampp\php\PEAR\Zend\Db.php(270):
Zend_Db_Adapter_Abstract->__construct(Array) #2
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(142):
Zend_Db::factory('PDO_MYSQL', Array) #3
C:\xampp\php\PEAR\Zend\Application\Resource\Db.php(154):
Zend_Application_Resource_Db->getDbAdapter() #4
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(683):
Zend_Application_Resource_Db->init() #5
C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(626):
Zend_Application_Bootstrap_BootstrapAbstract->_executeResource('db')
6 C:\xampp\php\PEAR\Zend\Application\Bootstrap\BootstrapAbstract.php(586):
Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap(NULL) #7
C:\xampp\php\PEAR\Zend\Ap in
C:\xampp\php\PEAR\Zend\Db\Adapter\Abstract.php on line 295
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.dbname = codenamesnm
i'm using xampp with windows 7 Any idea what is wrong
Do not omit these lines:
resources.db.params.username = rob
resources.db.params.password = 123456
set them to "root" or "" if necessary, but let them into your application.ini.