1

To set the background I am using Magento 2.3.0 and have imported (successfully so far) data from an existing multi-store site. I now can't access either the front end or the admin area of the site since the config has now changed and Magento throws an Exception requesting I rebuild config.php. The problem started when I changed a config key from the command line (the admin frontend URL).

Now when I try to rebuild /etc/config.php using

php bin/magento app:config:import

I receive the error Import failed: Invalid Base URL. The value must be a URL or one of the placeholders: {{base_url}} ... which incidentally is a pretty feeble error message as it doesn't even indicate which key is causing the problem.

After stepping through the code I can see one of the offending keys is web/unsecure/base_web_url for the default scope which is causing the problem since in Magento 2 core post config read processing it is returning http:/// which clearly is an invalid URL. This is despite the fact that in my database (in core_config_data) there is an entry for that path and scope with a valid URL (which does end with a trailing /).

Stepping deeper into the code I can see the problem is that module-store/Model/Config/Placeholder is calling /App/Request/Http->getDistroBaseUrl() which uses the PHP Server variable ['HTTP_HOST'] to determine the host which is blank when called from the command line and hence returns the http:///.

If anyone can shed any light on how this can be resolved I'd be very grateful.

3
  • Similar issue in the past was all down to cache ended up deleteing var/cache /generation and running setup upgrade after which worked fine make sure that parameter is set and valid in the database before as config is cached in magento 2 Commented Sep 3, 2019 at 11:46
  • Thanks Dava, I should have thought of that! Although, to be fair, the symptom was, typically, perplexingly obscure. Commented Sep 3, 2019 at 13:21
  • Glad its working will post as answer now so you can mark as resolved Commented Sep 3, 2019 at 13:29

1 Answer 1

0

Similar issue in the past was all down to cache in your CLI run the following

rm -rf var/cache/ generation/

After you have done the above run

php bin/magento setup:upgrade && php bin/magento setup:static-content:deplpoy

You may need to force the deployment process you can do that by adding -f to the end over the second command

after which worked fine make sure that parameter is set and valid in the database before as config is cached in magento 2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.