cancel
Showing results for 
Search instead for 
Did you mean: 

Local host Magento 2.9 can not survive without web

SOLVED

Local host Magento 2.9 can not survive without web

Hello, 

 

I observe many issues on our Magento on line web site.

So I want to have a mirror copy on my own.

 

Installed on my LINUX computer: 

- mysql, php7, and all need to run a web site.

 

What I've done: 

  • Copy all file from online to localhost
  • Copy the entire database from online to localhost
  • change the database credentials to fit with my localhost values ( siteaddrs/app/etc/env.php )
  • change the addresses in all core_config_data records

 

But still: my 127.0.0.1 web site flashes a local page and already shows the online website.

 

I cleaned the browser history, cookies and all.

I tried an other browser.

 

Always the same : If I work offline, I get an error message from browser "Unreachable website"; if I work online, the website shown is the online one.

 

What did I miss ? 

 

Thanks.

3 ACCEPTED SOLUTIONS

Accepted Solutions

Re: Local host Magento 2.9 can not survive without web

Hello @patrickafr2bd5 

 

Please change store config base url in core_config_data table

web/unsecure/base_url

web/secure/base_url

You have to change these two path values to your local path.

 

update core_config_data set value = 'http://local.com/' where path = 'web/unsecure/base_url';
update core_config_data set value = 'https://local.com/' where path = 'web/secure/base_url';

 

Run below command too:

php bin/magento c:f

Manish Mittal
https://www.manishmittal.com/

View solution in original post

Re: Local host Magento 2.9 can not survive without web

@patrickafr2bd5 

 

Clear browser and magento cache and try again! It will work.

Manish Mittal
https://www.manishmittal.com/

View solution in original post

Re: Local host Magento 2.9 can not survive without web

The real solution was:

 

php bin/magento cache:flush 
find . -type f -exec chmod 644 {} \;  
find . -type d -exec chmod 755 {} \; 
find ./var -type d -exec chmod 777 {} \; 
find ./pub/media -type d -exec chmod 777 {} \; 
find ./pub/static -type d -exec chmod 777 {} \; 
chmod 777 ./app/etcchmod 644 ./app/etc/*.xml 
chown -R :<web server group> . 
chmod u+x bin/magento 

Thanks to Manish

View solution in original post

7 REPLIES 7

Re: Local host Magento 2.9 can not survive without web

Hello @patrickafr2bd5 

 

Please change store config base url in core_config_data table

web/unsecure/base_url

web/secure/base_url

You have to change these two path values to your local path.

 

update core_config_data set value = 'http://local.com/' where path = 'web/unsecure/base_url';
update core_config_data set value = 'https://local.com/' where path = 'web/secure/base_url';

 

Run below command too:

php bin/magento c:f

Manish Mittal
https://www.manishmittal.com/

Re: Local host Magento 2.9 can not survive without web

Nice, thanks.

 

It's on its way to work.

It didn't know about the command.

 

Running the command  php bin/magento c:f

I get the following error message: 

An abstract factory could not create an instance of magentosetupmvcbootstrapinitparamlistener ( alias: Magento\Setup\Mvc\Bootstrap\InitParamListener ).

 

You have any idea what's about ? 

 

On my local server, all files and directories belong to www-data:www-data  ( which are the server id and group ) and have 770 as access rights.

 

I can find three  directories which have Mvc sub-directories:

- setup/src/Magento/Setup/Mvc

- magento/magento2-base/setup/src/Magento/Setup/Mvc

- vendor/magento/magento-2-base/setup/src/Magento/Setup/Mvc

All three of them have a InitParamLlistenerTest.php file

but no one had the InitParamListener.php file.

I copied files.  

 

No better results, still the same sentence: 

An abstract factory could not create an instance of magentosetupmvcbootstrapinitparamlistener ( alias: Magento\Setup\Mvc\Bootstrap\InitParamListener ).

 

Thanks.

Re: Local host Magento 2.9 can not survive without web

Hello @patrickafr2bd5 

 

I have shared mysql queries to change yoru website base url, which taking you to live server.

 

Please run those in Database and gave proper permission required:

chmod -R 0777 var/ pub/ generated/ 

Manish Mittal
https://www.manishmittal.com/

Re: Local host Magento 2.9 can not survive without web

Hello again, thanks for tips.

core_data_config has been modified to fit to my localhost  127.0.0.1

rights ( chmod and chown ) have been modified also.

Re: Local host Magento 2.9 can not survive without web

@patrickafr2bd5 

 

Clear browser and magento cache and try again! It will work.

Manish Mittal
https://www.manishmittal.com/

Re: Local host Magento 2.9 can not survive without web

The real solution was:

 

php bin/magento cache:flush 
find . -type f -exec chmod 644 {} \;  
find . -type d -exec chmod 755 {} \; 
find ./var -type d -exec chmod 777 {} \; 
find ./pub/media -type d -exec chmod 777 {} \; 
find ./pub/static -type d -exec chmod 777 {} \; 
chmod 777 ./app/etcchmod 644 ./app/etc/*.xml 
chown -R :<web server group> . 
chmod u+x bin/magento 

Thanks to Manish

Re: Local host Magento 2.9 can not survive without web

Good to hear! Pleasure to help you. Please let us know if you need any help.

Cheers!!

Manish Mittal
https://www.manishmittal.com/