Hi guys,
I set up my magento 2.3 on localhost via Xampp and all working perfectly.
I transferred magento folder and imported the database on server phpmyadmin.
I changed The core_config_data base URL and entered the env.php informations correctly.
When I google the store address in browser, it redirects me to Localhost (127.0.0.1).
If I clean the Var/cache folder, I can finally access to the live store, but all CMS seems to be down and the store frontend aspect completly destroyed.
Any solution for this issue ? is it a matter of htaccess ? Why does the store design get down each time I clear the var/cache folder ? Thank you for your advices.
Solved! Go to Solution.
A server can use different PHP versions for the command line and for webserver.
Please ensure you have the proper PHP versions for the command line.
You can do it by executing the php -v command from the Magento 2 root folder.
https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html
Can you try with php 7.2 once.
I tried, but still same redirection to localhost and same error on ssh command.
ok, will try... do I have to change something in .htaccess too ?
No nothing has to change in .htaccess. Did you added any local url? if not then no need to change
Please do changes in db table core_config_data to remove version from css:
insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);
and run below query:
php bin/magento setup:static-content:deploy -f php bin/magento cache:flush
Hello @jean _bertrand
Please check if do you have .htaccess or not in root folder and in pub folder.
Then give permission to folders:
find . -type d -exec chmod 755 {} \; && find . -type f -exec chmod 644 {} \; && chmod u+x bin/magento
run below commands:
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy php bin/magento cache:flush
Hello Manish,
Yes I have a .htaccess and a .htaccess.sample in root directory.
I gave permission to Pub and Var folders.
Once I run the command : php bin/magento setup:di:compile, I have a warning message telling the folder "not empty". If I continue, the frontend and admin get down with an error message... Whaooo !
I use ssh Mobalxterm.
Remove content of generated/code/* folder then run again command.
Could you give me the complete path to "generated/code" folder ?
On Magento root folder
rm -rf generated/code/*
Please check this document for more reference:
https://devdocs.magento.com/guides/v2.4/howdoi/php/php_clear-dirs.html
Thank you Manish,
Unfortunately, the commands php bin/magento setup:upgrade, shows a syntax error on my ssh.
May I run these commands on localhosts and then transfer the store on live server ?
But each time I run the command : php bin/magento setup:di:compile, the site gets down even in localhost... Do you have an idea about this issue ?
Not recommended that, later you has to run all these commands on server only so don't try any shortcuts.
I hope you will understand. Thanks
Ok, so on live server I run these commands in root directory right ? So why do I get syntax error ?