I have a production site using Database from an Amazon Server, I have two more sites on the same server and both of them connects without issues.
On this particular site the connection to mysql is not working, I thought that the env file was missing or not being see by the laravel app but is not the case, when I run php artisan tinker and try any command it works:
DB::table('categories')->get();
=> Illuminate\Support\Collection {#842
all: [
{#828
+"id": 1,
+"parent_id": null,
+"order": 1,
+"name": "Noticias",
+"slug": "noticias",
+"created_at": "2018-01-09 19:26:32",
+"updated_at": "2018-01-09 19:26:32",
},
],
}
The App::environment() method also works:
>>> App::environment();
=> "production"
The env files clearly says APP_DEBUG=false but it is returning a lot of debug, it is like the webserver is not reading the env file besides the artisan is.
This is driving me crazy because it started failing by itself, nothing was changed on the server or the code, it's the only project that is failing.
What else can I check?
[2018-08-25 12:22:04] production.ERROR: SQLSTATE[HY000] [2002] Connection refused {"exception":"[object] (PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:67)
[stacktrace]
#0 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(67): PDO->__construct('mysql:host=127....', 'root', 'C4f2469dcF!', Array)
#1 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(43): Illuminate\\Database\\Connectors\\Connector->createPdoConnection('mysql:host=127....', 'root', 'C4f2469dcF!', Array)
#2 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\\Database\\Connectors\\Connector->createConnection('mysql:host=127....', Array, Array)
#3 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(183): Illuminate\\Database\\Connectors\\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\\Database\\Connectors\\ConnectionFactory->Illuminate\\Database\\Connectors\\{closure}()
#5 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(915): call_user_func(Object(Closure))
#6 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(940): Illuminate\\Database\\Connection->getPdo()
#7 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(399): Illuminate\\Database\\Connection->getReadPdo()
#8 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(325): Illuminate\\Database\\Connection->getPdoForSelect(true)
#9 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(657): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('select * from `...', Array)
#10 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\\Database\\Connection->runQueryCallback('select * from `...', Array, Object(Closure))
#11 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select * from
`...', Array, Object(Closure))
#12 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1719): Illuminate\\Database\\Connection->select('select
* from `...', Array, true)
#13 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(1704): Illuminate\\Database\\Query\\Builder->runSelect()
#14 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(483): Illuminate\\Database\\Query\\Builder->get(Array)
#15 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(467): Illuminate\\Database\\Eloquent\\Builder->getModels(Array)
#16 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(360): Illuminate\\Database\\Eloquent\\Builder->get(Array)
#17 /var/app/html/releases/20180824022105/app/Category.php(13): Illuminate\\Database\\Eloquent\\Model::all()
#18 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(327): App\\Category::App\\{closure}()
#19 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php(304): Illuminate\\Cache\\Repository->remember('list-categories', NULL, Object(Closure))
#20 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Illuminate\\Cache\\CacheManager->__call('remember', Array)
#21 /var/app/html/releases/20180824022105/app/Category.php(20): Illuminate\\Support\\Facades\\Facade::__callStatic('remember', Array)
#22 /var/app/html/releases/20180824022105/routes/web.php(150): App\\Category::getCategories()
#23 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Routing/Router.php(389): Illuminate\\Routing\\Router->{closure}(Object(Illuminate\\Routing\\Router))
#24 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Routing/Router.php(349): Illuminate\\Routing\\Router->loadRoutes(Object(Closure))
#25 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(221): Illuminate\\Routing\\Router->group(Array, Object(Closure))
#26 /var/app/html/releases/20180824022105/routes/web.php(162): Illuminate\\Support\\Facades\\Facade::__callStatic('group', Array)
#27 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Routing/Router.php(393): require('/var/www/turico...')
#28 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Routing/Router.php(349): Illuminate\\Routing\\Router->loadRoutes('/var/www/turico...')
#29 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Routing/RouteRegistrar.php(105): Illuminate\\Routing\\Router->group(Array, '/var/www/turico...')
#30 /var/app/html/releases/20180824022105/app/Providers/RouteServiceProvider.php(56): Illuminate\\Routing\\RouteRegistrar->group('/var/www/turico...')
#31 /var/app/html/releases/20180824022105/app/Providers/RouteServiceProvider.php(40): App\\Providers\\RouteServiceProvider->mapWebRoutes()
#32 [internal function]: App\\Providers\\RouteServiceProvider->map()
#33 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#34 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#35 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#36 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#37 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php(74): Illuminate\\Container\\Container->call(Array)
#38 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Support/Providers/RouteServiceProvider.php(33): Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider->loadRoutes()
#39 /var/app/html/releases/20180824022105/app/Providers/RouteServiceProvider.php(28): Illuminate\\Foundation\\Support\\Providers\\RouteServiceProvider->boot()
#40 [internal function]: App\\Providers\\RouteServiceProvider->boot()
#41 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array)
#42 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#43 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#44 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#45 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(792): Illuminate\\Container\\Container->call(Array)
#46 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\\Foundation\\Application->bootProvider(Object(App\\Providers\\RouteServiceProvider))
#47 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(App\\Providers\\RouteServiceProvider), 26)
#48 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): array_walk(Array, Object(Closure))
#49 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#50 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(213): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#51 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#52 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): Illuminate\\Foundation\\Http\\Kernel->bootstrap()
#53 /var/app/html/releases/20180824022105/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#54 /var/app/html/releases/20180824022105/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#55 {main}
"}
You should verify if you have bootstrap/cache/config.php file. If yes, it means, your config is cached. Than you can run:
php artisan config:cache
to refresh config and sync data you have set in .env or
php artisan config:clear
if you don't want to use cached config (keep in mind it's recommended to cache config on production)
The solution for me was to restart the laravel development server, ie: run php artisan serve again.
I had changed the db config after I had originally run the dev server.
I had a similar problem, I installed php7.2-mysql after I installed everything else. Tinker was working perfectly but my application would not connect.
I spent 2 hours trying to debug until a simple apache restart did the trick.
The problem is that mysql's root user can't be used anymore, since mysql v5.7. More about this here.
Related
Hi every one I am currently working on laravel 5.8 and recently installed spatie/laravel-backup package to backup my files and db and i did all the steps which are needed to use the package but when I run the command
php artisan backup:run it gives many errors as below
Starting backup... Dumping database u452010341_qkcg... Backup failed
because The dump process failed with exitcode 1 : General error :
'"mysqldump"' is not recognized as an internal or external command,
operable program or batch file.
#0 C:\xampp\htdocs\b\vendor\spatie\db-dumper\src\DbDumper.php(246): Spatie\DbDumper\Exceptions\DumpFailed::processDidNotEndSuccessfully(Object(Symfony\Component\Process\Process))
#1 C:\xampp\htdocs\b\vendor\spatie\db-dumper\src\Databases\MySql.php(190): Spatie\DbDumper\DbDumper->checkIfDumpWasSuccessFul(Object(Symfony\Component\Process\Process), 'C:\\xampp\\htdocs...')
#2 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Tasks\Backup\BackupJob.php(250): Spatie\DbDumper\Databases\MySql->dumpToFile('C:\\xampp\\htdocs...')
#3 [internal function]: Spatie\Backup\Tasks\Backup\BackupJob->Spatie\Backup\Tasks\Backup\{closure}(Object(Spatie\DbDumper\Databases\MySql), 'mysql')
#4 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Support\Collection.php(1120): array_map(Object(Closure), Array, Array)
#5 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Tasks\Backup\BackupJob.php(253): Illuminate\Support\Collection->map(Object(Closure))
#6 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Tasks\Backup\BackupJob.php(167): Spatie\Backup\Tasks\Backup\BackupJob->dumpDatabases()
#7 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Tasks\Backup\BackupJob.php(143): Spatie\Backup\Tasks\Backup\BackupJob->createBackupManifest()
#8 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Commands\BackupCommand.php(52): Spatie\Backup\Tasks\Backup\BackupJob->run()
#9 [internal function]: Spatie\Backup\Commands\BackupCommand->handle()
#10 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(32): call_user_func_array(Array, Array)
#11 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#13 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Container\Container.php(576): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#14 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Console\Command.php(183): Illuminate\Container\Container->call(Array)
#15 C:\xampp\htdocs\b\vendor\symfony\console\Command\Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#16 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Console\Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#17 C:\xampp\htdocs\b\vendor\spatie\laravel-backup\src\Commands\BaseCommand.php(16): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 C:\xampp\htdocs\b\vendor\symfony\console\Application.php(1012): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 C:\xampp\htdocs\b\vendor\symfony\console\Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\BackupCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 C:\xampp\htdocs\b\vendor\symfony\console\Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Console\Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 C:\xampp\htdocs\b\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(133): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 C:\xampp\htdocs\b\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}
Backup failed because: The dump process failed with exitcode 1 : General error : '"mysqldump"' is not recognized as an internal or external command,
operable program or batch file.
I searched for solutions and found the code below:
'connections' => [
'mysql' => [
'driver' => 'mysql'
...,
'dump' => [
'dump_binary_path' => '/path/to/the/binary', // only the path, so without `mysqldump` or `pg_dump`
'use_single_transaction',
'timeout' => 60 * 5, // 5 minute timeout
'exclude_tables' =>['table1', 'table2'],`enter code here`
'add_extra_option' =>'--optionname=optionvalue',
]
],
But still I'm getting same error... I tried more than 100times, still nothing.
So any one who gone through this problem or any body who knows how to solve this please help me out.
in the code you found, where says:
'dump_binary_path' => '/path/to/the/binary',
Change to:
'dump_binary_path' => 'C:\xampp\mysql\bin',
Next time, look to the errors because int his case, the problem is well described!
Regards
Now you also need to comment this line:
//'add_extra_option' =>'--optionname=optionvalue',
working for me.
Recently I've upgraded Laravel from 5.8 to 6.0 and made some adjusts to make it running smoothly.
In my local environment, it works fine. But when I publish in my server, when I try to send some notifications (mail and broadcast) I receive the following error:
ErrorException: Undefined property: Illuminate\Notifications\ChannelManager::$container in /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php:53
Stack trace:
#0 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(53): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Undefined prope...', '/var/www/vialoc...', 53, Array)
#1 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Notifications/SendQueuedNotifications.php(73): Illuminate\Notifications\ChannelManager->sendNow(Object(App\Models\User), Object(App\Notifications\UserConfirmationNotification), Array)
#2 [internal function]: Illuminate\Notifications\SendQueuedNotifications->handle(Object(Illuminate\Notifications\ChannelManager))
#3 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#4 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#5 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#6 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/Container.php(580): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#7 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(94): Illuminate\Container\Container->call(Array)
#8 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#9 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#10 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(98): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#11 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(83): Illuminate\Bus\Dispatcher->dispatchNow(Object(Illuminate\Notifications\SendQueuedNotifications), false)
#12 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(130): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#13 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(105): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Notifications\SendQueuedNotifications))
#14 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(85): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#15 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(59): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Notifications\SendQueuedNotifications))
#16 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(88): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\RedisJob), Array)
#17 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(327): Illuminate\Queue\Jobs\Job->fire()
#18 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(277): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#19 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(118): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#20 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(102): Illuminate\Queue\Worker->daemon('redis', 'vialoc-api,defa...', Object(Illuminate\Queue\WorkerOptions))
#21 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(86): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'vialoc-api,defa...')
#22 [internal function]: Illuminate\Queue\Console\WorkCommand->handle()
#23 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#24 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#25 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#26 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Container/Container.php(580): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#27 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#28 /var/www/vialoc_api/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#29 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#30 /var/www/vialoc_api/vendor/symfony/console/Application.php(908): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /var/www/vialoc_api/vendor/symfony/console/Application.php(269): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 /var/www/vialoc_api/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /var/www/vialoc_api/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /var/www/vialoc_api/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 {main}
And one note: To upgrade to Laravel 6 on my server, I needed to upgrade to PHP 7.2. I've done this and I think there is some PHP module missing. But I'm stuck to resolve this issue.
To notifications, I'm using Redis for Queue. And I've tried to sent the emails through mailtrap and mailgun, but the response is the same.
Please someone can help me? Tks a lot in advance.
I've discovered the problem.
My queue was being managed by a supervisor process. And with the upgrade and the code change, the process didn't update the code being processed.
When I ran the following command:
sudo supervisorctl restart all
Everything starts working again.
Running composer install on your server should list any missing modules.
I've uploaded my laravel 5.6 project on Ubuntu 16.04.4.
When i upload my working project(API's tested on postman) on it, it returns a blank response and on the url it states "This page isn’t working" "HTTP ERROR 500".
From what I've learnt is that the php version of my project and is different from the one on the server.
My project is built on php 7.1.9 and the server php version is 7.1.18
Any form of help or information will be useful.
Thank you in advance
Log:
local.ERROR: syntax error, unexpected '?', expecting variable (T_VARIABLE) {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThr$
[stacktrace]
#0 /var/www/narcodes/vendor/composer/ClassLoader.php(322): Composer\\Autoload\\includeFile('/var/www/narcod...')
#1 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('Symfony\\\\Compone...')
#2 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/RouteCompiler.php(39): spl_autoload_call('Symfony\\\\Compone...')
#3 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Route.php(284): Illuminate\\Routing\\RouteCompiler->compile()
#4 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Route.php(261): Illuminate\\Routing\\Route->compileRoute()
#5 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(197): Illuminate\\Routing\\Route->matches(Object(Illuminate\\Http\\Request), t$
#6 [internal function]: Illuminate\\Routing\\RouteCollection->Illuminate\\Routing\\{closure}(Object(Illuminate\\Routing\\Route), 'api/user')
#7 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Support/Arr.php(175): call_user_func(Object(Closure), Object(Illuminate\\Routing\\Route), 'api/user')
#8 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Support/Collection.php(657): Illuminate\\Support\\Arr::first(Array, Object(Closure), NULL)
#9 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(198): Illuminate\\Support\\Collection->first(Object(Closure))
#10 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(164): Illuminate\\Routing\\RouteCollection->matchAgainstRoutes(Object(Illumin$
#11 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(619): Illuminate\\Routing\\RouteCollection->match(Object(Illuminate\\Http\\Request))
#12 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(608): Illuminate\\Routing\\Router->findRoute(Object(Illuminate\\Http\\Request))
#13 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Router.php(597): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#14 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#15 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(O$
#16 /var/www/narcodes/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Obj$
#18 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illumina$
#19 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\$
#20 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Il$
#21 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illumina$
#22 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\$
#23 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Il$
#24 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illumina$
#25 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\$
#26 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Ill$
#27 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illumina$
#28 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(51): Illuminate\\Routing\\Pipeline->Illuminate\\Ro$
#29 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Obj$
#30 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illumina$
#31 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illumina$
#32 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#33 /var/www/narcodes/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Il$
#34 /var/www/narcodes/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#35 {main}
"}
This error is because your php server version, can be different from what you see when doing php -v.
The right way to check this is to do a php info on your server side, not on CLI.
If you need to enable php 7.2 on apache this is the command on ubuntu
first disable old php version
sudo a2dismod php7.0
enable new version
sudo a2enmod php7.2
everyone
I have a website built with Laravel 5.4 (latest version) and I'm getting this "SuspiciousOperationException: Invalid Host error" on my logs many times a day. Even though it doesn't seem to be affecting my website's functionality, I'm worried it might be a symptom of some misconfiguration – and, at the very least, it's polluting my log files, making error tracking a little harder.
I've tried to figure out what's causing this on my own, but my lack of experience has shown… I have some idea of what might be causing this, but I have no confirmation of my theory and I have no clue of how to solve the issue.
The error message is the following:
[2017-08-03 23:47:03] production.ERROR: Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Invalid Host "*.example.com". in /var/www/laravel/vendor/symfony/http-foundation/Request.php:1283
And the stack trace:
#0 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1088): Symfony\Component\HttpFoundation\Request->getHost()
#1 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1118): Symfony\Component\HttpFoundation\Request->getHttpHost()
#2 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1815): Symfony\Component\HttpFoundation\Request->getSchemeAndHttpHost()
#3 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1102): Symfony\Component\HttpFoundation\Request->prepareRequestUri()
#4 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1867): Symfony\Component\HttpFoundation\Request->getRequestUri()
#5 /var/www/laravel/vendor/symfony/http-foundation/Request.php(985): Symfony\Component\HttpFoundation\Request->prepareBaseUrl()
#6 /var/www/laravel/vendor/symfony/http-foundation/Request.php(1933): Symfony\Component\HttpFoundation\Request->getBaseUrl()
#7 /var/www/laravel/vendor/symfony/http-foundation/Request.php(945): Symfony\Component\HttpFoundation\Request->preparePathInfo()
#8 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Http/Request.php(138): Symfony\Component\HttpFoundation\Request->getPathInfo()
#9 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Matching/UriValidator.php(19): Illuminate\Http\Request->path()
#10 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php(259): Illuminate\Routing\Matching\UriValidator->matches(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#11 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(193): Illuminate\Routing\Route->matches(Object(Illuminate\Http\Request), true)
#12 [internal function]: Illuminate\Routing\RouteCollection->Illuminate\Routing\{closure}(Object(Illuminate\Routing\Route), 'api/user')
#13 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Support/Arr.php(175): call_user_func(Object(Closure), Object(Illuminate\Routing\Route), 'api/user')
#14 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(194): Illuminate\Support\Arr::first(Array, Object(Closure))
#15 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php(164): Illuminate\Routing\RouteCollection->matchAgainstRoutes(Array, Object(Illuminate\Http\Request))
#16 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(548): Illuminate\Routing\RouteCollection->match(Object(Illuminate\Http\Request))
#17 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(527): Illuminate\Routing\Router->findRoute(Object(Illuminate\Http\Request))
#18 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Router.php(513): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#19 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#20 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#21 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#22 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#25 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#26 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#27 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#28 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#31 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#32 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#33 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#34 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#36 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#37 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#40 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(148): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#42 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#43 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#44 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#45 /var/www/laravel/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#46 {main}
The configuration data that I think might be related is as follows:
.env:
APP_URL=example.com
(I've tried a few other values like the ones below:)
http://www.example.com
http://*.example.com
config/app:
'url' => env('APP_URL', 'example.dev')
My website works on both http://example.com and http://www.example.com ; I've noticed that sessions aren't shared between them, but everything else is the same.
Any help solving this issue would be much appreciated. Thank you in advance!
EDIT: redacted the domain name
I had the same issue, but for me removing the wildcard from my nginx server_name directive wasn't an option. (My website depends on dynamic subdomain routing).
The problem is related to PHP variable $_SERVER['SERVER_NAME'] not being set correctly by nginx when there is a wildcard in the server_name. To fix it, you have to add the following in your nginx config:
fastcgi_param SERVER_NAME $host
For example:
location ~ \.php$ {
...
fastcgi_param SERVER_NAME $host
...
}
I've finally tracked down what was causing this: it was nginx's configuration.
I had configured my server's server_name directive as *.example.com – which is a valid wildcard name for the directive, as seen at http://nginx.org/en/docs/http/server_names.html , but doesn't seem to play well with Laravel. I haven't had this exception be thrown since I changed the value to example.com www.example.com a couple of days ago, so this definitely seemed to do the trick.
My website uses Magento and is hosted on Godaddy. It was working fine till yesterday but today, it is showing the following error :
There has been an error processing your request
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Trace:
#0 /home/greenveggy/public_html/lib/Zend/Db/Adapter/Pdo/Mysql.php(109): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /home/greenveggy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /home/greenveggy/public_html/lib/Zend/Db/Adapter/Abstract.php(460): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /home/greenveggy/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /home/greenveggy/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource->getConnection('core_write')
#8 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract->_getConnection('write')
#9 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract->_getWriteAdapter()
#10 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(360): Mage_Core_Model_Resource_Db_Abstract->_getReadAdapter()
#11 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Resource/Db/Collection/Abstract.php(134): Mage_Core_Model_Resource_Db_Abstract->getReadConnection()
#12 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Config.php(1348): Mage_Core_Model_Resource_Db_Collection_Abstract->__construct(Object(Mage_Core_Model_Resource_Website))
#13 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Config.php(1380): Mage_Core_Model_Config->getModelInstance('core_resource/w...', Object(Mage_Core_Model_Resource_Website))
#14 /home/greenveggy/public_html/app/Mage.php(491): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#15 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Abstract.php(208): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Resource_Website))
#16 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()
#17 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/App.php(608): Mage_Core_Model_Abstract->getCollection()
#18 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/App.php(466): Mage_Core_Model_App->_initStores()
#19 /home/greenveggy/public_html/app/code/core/Mage/Core/Model/App.php(349): Mage_Core_Model_App->_initCurrentStore('', 'store')
#20 /home/greenveggy/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#21 /home/greenveggy/public_html/index.php(87): Mage::run('', 'store')
#22 {main}
How do i resolve this ?
you can use the tool n98-magerun.phar (link) with task sys:check to test yout db-connection
you have to copy the file to path /home/greenveggy/public_html/ and make it executable
then cd to this path and execute ./n98-magerun.phar sys:check
if the connection fails check your properties in /home/greenveggy/public_html/app/etc/local.xml
Pressing the "check" button for the Database solved the problem. Site is functional again. Can anyone explain what just happened?