I am working on a Drupal 8 site. This site was working. I recently moved to another machine.
It is showing errors like:
Recoverable fatal error: Argument 1 passed to
Drupal\Component\DependencyInjection\Container::__construct() must be of
the type array, boolean given, called in [DRUPAL-
PATH]/core/lib/Drupal/Core/DrupalKernel.php on line 883 and defined in
[DRUPAL-PATH]/core/lib/Drupal/Component/DependencyInjection/Container.php
on line 119 #0 [DRUPAL-PATH]/core/includes/bootstrap.inc(550):
_drupal_error_handler_real(4096, 'Argument 1 pass...',
'/Applications/M...', 119, Array)
I need to clear cache programmatically.
Try below.
cache_clear_all() // For Drupal-7
drupal_flush_all_caches() // For Drupal-8