Difference between revisions of "Magento 2 Quick Setup Check"

From Moogento How-to Guides
Jump to navigation Jump to search
m
 
(141 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
First up, Magento 2 won't work with some versions.
 
First up, Magento 2 won't work with some versions.
  
Here's the current list of accepted versions:
+
Here's the current list of accepted versions, for Magento 2.4:
 +
 
 +
7.4 : Too easy!
 +
 
 +
(Not: 7.4.2)
 +
(You can use 7.3 but it's not tested or recommended).
 +
 
 +
And for Magento 2.3:
 +
 
 +
[[File:acceptable-magento-versions-magento-23.png|link=|500px]]
 +
 
 +
And for Magento 2.2:
  
 
[[File:acceptable-magento-versions.png|link=|500px]]
 
[[File:acceptable-magento-versions.png|link=|500px]]
  
 
Check the official requirements list [https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html here].
 
Check the official requirements list [https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html here].
 +
 
====Running Magento 2 Locally====
 
====Running Magento 2 Locally====
 
If you're running this locally, if you're using something like MAMP, check in the settings:
 
If you're running this locally, if you're using something like MAMP, check in the settings:
Line 41: Line 53:
 
If they don't then time to fix.
 
If they don't then time to fix.
  
=====CLI PHP doesn't match!=====
+
=====Remote / cPanel-type install=====
If you're running on something like cPanel, then you might find the CommandLineInterface doesn't use the 'correct' version of PHP.
+
:If you're running on something like cPanel, then you might find the CommandLineInterface doesn't use the 'correct' version of PHP.
 +
 
 +
:You can then specify the specific version to use, eg.:
 +
 
 +
:<code>php -ea_php 74 -v</code>
 +
 
 +
: ''eg. here we're specifying to use php7.4 when running the command '-v' (= 'check php version')''
  
You can then specify the specific version to use, eg.:
 
  
<code>php -ea_php 71 -v</code>
 
  
====Fixing Different PHP Versions in Commandline and MAMP====
+
=====Local / MAMP-type install=====
  
We want to get the commandline to use MAMP's version.
+
:We want to get the commandline to use MAMP's version.
  
1. Edit the system settings to tell it to get PHP from the MAMP version:
+
:1. Edit the system settings to tell it to get PHP from the MAMP version:
  
<code>nano ~/.bash_profile</code>
+
:<code>nano ~/.bash_profile</code>
  
Add this line, editing the php version to match whatever you have selected in MAMP:
+
:Add this line, editing the php version to match whatever you have selected in MAMP:
  
<code>alias phpmamp='/Applications/MAMP/bin/php7.1.12/bin/php'</code>
+
:<code>alias phpmamp='/Applications/MAMP/bin/php7.1.12/bin/php'</code>
  
2. Check where the local system is getting php from:
+
:2. Check where the local system is getting php from:
  
<code>which php</code>
+
:<code>which php</code>
  
which should return something like:
+
:which should return something like:
  
<code>/usr/local/bin/php</code>
+
:<code>/usr/local/bin/php</code>
  
3. Backup this php, using the path from (2):
+
:3. Backup this php, using the path from (2):
  
<code>sudo mv /usr/local/bin/php /usr/local/bin/php.bak</code>
+
:<code>sudo mv /usr/local/bin/php /usr/local/bin/php.bak</code>
  
4. Make an alias to the MAMP PHP version, using the path from (2) and the PHP version from MAMP:
+
:4. Make an alias to the MAMP PHP version, using the path from (2) and the PHP version from MAMP:
  
<code>sudo ln -s /Applications/MAMP/bin/php/php7.1.12/bin/php /usr/local/bin/php</code>
+
:<code>sudo ln -s /Applications/MAMP/bin/php/php7.1.12/bin/php /usr/local/bin/php</code>
  
5. Reload the new settings:
+
:5. Reload the new settings:
  
<code>source ~/.bash_profile</code>
+
:<code>source ~/.bash_profile</code>
  
6. Check the new version is sticking:
+
:6. Check the new version is sticking:
  
<code>php -v</code>
+
:<code>php -v</code>
  
 
===Make Initial PHP Settings===
 
===Make Initial PHP Settings===
Line 122: Line 138:
  
 
<code>zend_extension="...</code>
 
<code>zend_extension="...</code>
 +
 +
eg:
 +
 +
<code>zend_extension="/Applications/MAMP/bin/php/php7.4.2/lib/php/extensions/no-debug-non-zts-20170718/opcache.so"</code>
  
 
Add this line near the above line:
 
Add this line near the above line:
Line 128: Line 148:
  
 
^ This turns on PHP caching which will make decent improvements to the speed Magento runs at.
 
^ This turns on PHP caching which will make decent improvements to the speed Magento runs at.
 +
 +
===PHP Extensions for Magento 2===
 +
Find php.ini in your system.
 +
 +
<code>which php</code>
 +
 +
For MAMP it'll be eg:
 +
{{folder|/Applications/MAMP/bin/php/php7.4.2/conf/php.ini}}
 +
 +
Open that and remove the semicolon ; from <code>;extension=php_intl.dll</code>
 +
 +
Edit your bash_profile to check paths:
 +
 +
<code>nano ~/.bash_profile</code>
 +
 +
Then check you have the correct paths to your PHP version. Eg. in MAMP:
 +
 +
<code>alias phpmamp='/Applications/MAMP/bin/php7.4.2/bin/php'</code>
 +
 +
<code>alias php='/Applications/MAMP/bin/php/php7.4.2/bin/php'</code>
 +
 +
<code>export PATH="/usr/local/bin:/usr/local/sbin:/Applications/MAMP/bin/php/php7.4.2/bin:$PATH"</code>
 +
 +
Then reload:
 +
 +
<code>. ~/.bash_profile</code>
  
 
====Check PHP Version====
 
====Check PHP Version====
Line 135: Line 181:
 
<code>php -v</code>
 
<code>php -v</code>
  
 +
===Check file/folder ownership/permissions===
 +
====Background====
 +
List all users in the system:
 +
 +
<code>compgen -u</code>
 +
 +
^ ''The user you want to assign magento ownership to should be in here''
 +
 +
====In 1-user (eg. cPanel) setups====
 +
# Navigate to the magento install folder (the one with /app /var etc. in) in eg. FIleZilla,
 +
#: or via CLI eg. <code>cd public_html/example_site.com</code>
 +
# Check write permissions are set for these folders:
 +
## vendor
 +
## app/etc
 +
## pub/static
 +
## var
 +
## generated
 +
## ''{any other static resources}''
 +
# If you need to change those permissions, use either FileZilla again,
 +
#: or via CLI eg.
 +
#:<code>find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {}</code>
 +
#:<code>find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {}</code>
 +
#:<code>chmod u+x bin/magento</code>
 +
#:
 +
# Check file/folder permissions
 +
#:''In general the recommended permissions are 644 for files, 755 for folders.''
 +
#:''If the previous steps didn't work for you, give this a go:''
 +
#:<code>find . -type f -exec chmod 644 {} \;</code>
 +
#:<code>find . -type d -exec chmod 755 {} \;</code>
 +
 +
====In 2-user (eg. VPS) setups====
 +
# Switch to the '''Main system user''' (usually '''not''' the '''Magento file system user''')
 +
#: CentOS: <code>su - {username, eg. magento_user}</code>
 +
#: Ubuntu: <code>su {username, eg. magento_user}</code>
 +
# Make the user that will be the '''Magento file system user''':
 +
#: <code>sudo adduser {username}</code>
 +
#:: ''(Replacing {username} with the actual name for this user you want to create, eg. 'magento_user')''
 +
# Give that user a password:
 +
#: <code>sudo passwd {username, eg. magento_user}</code>
 +
# Find the '''web server user''' (usually 'apache' in CentOs, or 'www-data' in Ubuntu):
 +
#: CentOS: <code>grep -E -i '^user|^group' /etc/httpd/conf/httpd.conf</code>
 +
#: Ubuntu: <code>ps aux | grep apache</code> to find the user, then <code>groups {apache user}</code> to find the group
 +
# Move the  '''Magento file system user''' in the '''web server user''' group:
 +
#: CentOS: <code>sudo usermod -a -G apache {username}</code>
 +
#: Ubuntu: <code>sudo usermod -a -G www-data {username}</code>
 +
#: eg. in CentOS: <code>sudo usermod -a -G apache magento_user</code>
 +
#:  ''^ Assuming the web server user you found earlier is "apache" or "www-data"''
 +
# Check your '''Magento file system user''' is in the '''web server user''' group:
 +
#: <code>groups magento_user</code>
 +
#: eg. this would mean primary is 'magento' and secondary is 'apache': ''magento_user : magento_user apache''
 +
# Restart the server:
 +
#: CentOS: <code>service httpd restart</code>
 +
#: Ubuntu: <code>service apache2 restart</code>
 +
# Switch to the '''Magento file system user'''
 +
#: CentOS: <code>su - {username, eg. magento_user}</code>
 +
#: Ubuntu: <code>su {username, eg. magento_user}</code>
 +
# While logged in to the server as the '''Magento file system user''', navigate to the Magento install folder, then set the ownership/permissions:
 +
#: <code>find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;</code>
 +
#: <code>sudo chown -R :{web server group, eg. apache} .</code>
 +
#: <code>chmod u+x bin/magento</code>
  
 
===Check Magento 2 Version===
 
===Check Magento 2 Version===
 
<code>php bin/magento --version</code>
 
<code>php bin/magento --version</code>
  
====Update Magento 2 Version====
+
====Update Magento 2.4.x Version====
 +
# Check you have elasticsearch running - this is a new requirement with 2.4+
 +
# Show the maintenance page
 +
#: <code>php bin/magento maintenance:enable</code>
 +
# Install composer update plugin:
 +
#: <code>composer require magento/composer-root-update-plugin=~1.0 --no-update</code>
 +
#: <code>composer update</code>
 +
# Update to a specific version
 +
#: <code>composer require magento/product-community-edition 2.4.2 --no-update</code>
 +
#: <code>composer update</code>
 +
#:: ''If you get an error like "Your requirements could not be resolved to an installable set of packages", try this''
 +
#: <code>composer update --ignore-platform-reqs</code>
 +
#:: ''If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:''
 +
#:: <code>curl -sS https://getcomposer.org/installer | php -d allow_url_fopen=On</code>
 +
#:: <code>php composer.phar require magento/product-community-edition 2.4.2 --no-update</code>
 +
#:: <code>php -d memory_limit=-1 composer.phar update</code>
 +
# Update database
 +
#: <code>php bin/magento setup:upgrade</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 74 bin/magento setup:upgrade</code>
 +
# Recompile
 +
#: <code>php bin/magento setup:di:compile</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 74 bin/magento setup:di:compile</code>
 +
# Refresh indexes & clear the cache
 +
#: <code>php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 74 bin/magento indexer:reindex && php -d memory_limit=1G -ea_php 74 bin/magento cache:clean && php -d memory_limit=1G -ea_php 73 bin/magento cache:flush && php -d memory_limit=1G -ea_php 74 bin/magento cache:enable</code>
 +
# Hide the maintenance page
 +
#: <code>php bin/magento maintenance:disable</code>
 +
# Check version
 +
#: <code>php bin/magento --version</code>
 +
#:: ''or, on a cPanel-type setup:''
 +
#:: <code>php -ea_php 74 bin/magento  --version</code>
 +
 
 +
====Update Magento 2.3.x Version====
 
# Show the maintenance page
 
# Show the maintenance page
 
#: <code>php bin/magento maintenance:enable</code>
 
#: <code>php bin/magento maintenance:enable</code>
 
# Update to a specific version
 
# Update to a specific version
#: <code>composer require magento/product-community-edition 2.2.5 --no-update</code>
+
#: <code>composer require magento/product-community-edition 2.3.5 --no-update</code>
 +
#: <code>composer update</code>
 +
#:: ''If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:''
 +
#:: <code>curl -sS https://getcomposer.org/installer | php -d allow_url_fopen=On</code>
 +
#:: <code>php composer.phar require magento/product-community-edition 2.3.5 --no-update</code>
 +
#:: <code>php -d memory_limit=-1 composer.phar update</code>
 +
# Update database
 +
#: <code>php bin/magento setup:upgrade</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 73 bin/magento setup:upgrade</code>
 +
# Recompile
 +
#: <code>php bin/magento setup:di:compile</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 73 bin/magento setup:di:compile</code>
 +
# Refresh indexes & clear the cache
 +
#: <code>php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=1G -ea_php 73 bin/magento indexer:reindex && php -d memory_limit=1G -ea_php 73 bin/magento cache:clean && php -d memory_limit=1G -ea_php 73 bin/magento cache:flush && php -d memory_limit=1G -ea_php 73 bin/magento cache:enable</code>
 +
# Hide the maintenance page
 +
#: <code>php bin/magento maintenance:disable</code>
 +
# Check version
 +
#: <code>php bin/magento --version</code>
 +
#:: ''or, on a cPanel-type setup:''
 +
#:: <code>php -ea_php 73 bin/magento  --version</code>
 +
 
 +
====Update to Magento 2.3 from 2.2.x====
 +
{{idea|Magento 2.3 has a minimum PHP version 7.1.3 or 7.2.x : check that first!}}
 +
# Show the maintenance page
 +
#: <code>php -d memory_limit=128M bin/magento maintenance:enable</code>
 +
# Make some changes to composer.json to deal with the new version:
 +
#: <code>composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update</code>
 +
#: <code>composer require --dev friendsofphp/php-cs-fixer:~2.10.1 --no-update</code>
 +
#: <code>composer require --dev sebastian/phpcpd:~3.0.0 --no-update</code>
 +
#: <code>composer require --dev phpunit/phpunit:~6.2.0 --no-update</code>
 +
#: <code>composer require --dev lusitanian/oauth:~0.8.10 --no-update</code>
 +
#: <code>composer require --dev pdepend/pdepend:2.5.2 --no-update</code>
 +
#: <code>composer require --dev squizlabs/php_codesniffer:3.2.2 --no-update</code>
 +
#:
 +
#:: ''If you're running on a cPanel-type setup, you might need:''
 +
#:: <code>php -d allow_url_fopen=On composer.phar remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev friendsofphp/php-cs-fixer:~2.10.1 --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev sebastian/phpcpd:~3.0.0 --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev phpunit/phpunit:~6.2.0 --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev lusitanian/oauth:~0.8.10 --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev pdepend/pdepend:2.5.2 --no-update</code>
 +
#:: <code>php -d allow_url_fopen=On composer.phar require --dev squizlabs/php_codesniffer:3.2.2 --no-update</code>
 +
#:
 +
#: <code>php -r '$autoload=json_decode(file_get_contents("composer.json"), true); $autoload["autoload"]["psr-4"]["Zend\\Mvc\\Controller\\"]= "setup/src/Zend/Mvc/Controller/"; file_put_contents("composer.json", json_encode($autoload, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));'</code>
 +
# Update to a specific version
 +
#: <code>composer require magento/product-community-edition 2.3 --no-update</code>
 
#: <code>composer update</code>
 
#: <code>composer update</code>
 
#:: ''If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:''
 
#:: ''If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:''
 
#:: <code>curl -sS https://getcomposer.org/installer | php</code>
 
#:: <code>curl -sS https://getcomposer.org/installer | php</code>
#:: <code>php composer.phar require magento/product-community-edition 2.2.5 --no-update</code>
+
#:: <code>php composer.phar require magento/product-community-edition 2.3 --no-update</code>
#:: <code>php composer.phar update</code>
+
#:: <code>php -d allow_url_fopen=On -d memory_limit=128M -ea_php 72 composer.phar update</code>
 
# Update database
 
# Update database
 
#: <code>php bin/magento setup:upgrade</code>
 
#: <code>php bin/magento setup:upgrade</code>
 
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
#:: <code>php -ea_php 71 bin/magento setup:upgrade</code>
+
#:: <code>php -d memory_limit=128M -ea_php 72 bin/magento setup:upgrade</code>
 +
# Recompile
 +
#: <code>php bin/magento setup:di:compile</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=512M -ea_php 72 bin/magento setup:di:compile</code>
 
# Refresh indexes & clear the cache
 
# Refresh indexes & clear the cache
 
#: <code>php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 
#: <code>php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 +
#:: ''If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:''
 +
#:: <code>php -d memory_limit=512M -ea_php 72 bin/magento indexer:reindex && php -d memory_limit=512M -ea_php 72 bin/magento cache:clean && php -d memory_limit=512M -ea_php 72 bin/magento cache:flush && php -d memory_limit=512M -ea_php 72 bin/magento cache:enable</code>
 
# Hide the maintenance page
 
# Hide the maintenance page
#: <code>php bin/magento maintenance:disable</code>
+
#: <code>php -d memory_limit=128M bin/magento maintenance:disable</code>
 
# Check version
 
# Check version
 
#: <code>php bin/magento --version</code>
 
#: <code>php bin/magento --version</code>
 +
#:: ''or, on a cPanel-type setup:''
 +
#:: <code>php -ea_php 72 bin/magento  --version</code>
 +
 +
===Check https===
 +
 +
====Check your cert====
 +
First check that you have installed your SSH cert correctly.
 +
# Go to https://''{your site domain}''
 +
# Click the lock on the left of the URL
 +
# Check it shows valid
 +
 +
====Set your Magento config to point to https====
 +
 +
:{{idea|These will set default values - for a multi-site setup you'll need to edit this}}
 +
 +
:<code>bin/magento setup:store-config:set --use-secure 1</code>
 +
 +
:<code>bin/magento setup:store-config:set --use-secure-admin 1</code>
 +
 +
:<code>bin/magento setup:store-config:set --base-url "https://''{your site domain}''/"</code>
 +
 +
:<code>bin/magento setup:store-config:set --base-url-secure "https://''{your site domain}''/"</code>
 +
 +
:''* If your magento install isn't in the public root, add that path after your domain in the commands above (don't miss the trailing slash)''
 +
 +
====Check non-https auto-redirects to https====
 +
# Go to http://''{your site domain}''
 +
# It should redirect to https://''{your site domain}''
 +
 +
===Check cron runs via CLI===
 +
<code>php bin/magento cron:run</code>
 +
 +
====If needed, setup Magento cron====
 +
 +
Run <code>crontab -e</code> to see & edit what crons are being run on the server.
 +
 +
Check you have these 3 Magento crons set:
  
===Magento Cache===
+
<code>* * * * * php {magento install dir}/bin/magento cron:run | grep -v "Ran jobs by schedule" >> {magento install dir}/var/log/magento.cron.log</code>
 +
 
 +
<code>* * * * * php {magento install dir}/update/cron.php >> {magento install dir}/var/log/update.cron.log</code>
 +
 
 +
<code>* * * * * php {magento install dir}/bin/magento setup:cron:run >> {magento install dir}/var/log/setup.cron.log</code>
 +
 
 +
{{idea|If you're running a dev site, consider setting the cron to run every 15 mins: */15 * * * *}}
 +
 
 +
===Set language, currency, timezone===
 +
 
 +
{{idea|These will set default values - for a multi-site setup you'll need to edit this}}
 +
 
 +
====Language====
 +
List the available language options:
 +
 
 +
<code>bin/magento info:language:list</code>
 +
 
 +
Eg. to set French:
 +
 
 +
<code>bin/magento setup:store-config:set --language fr_FR</code>
 +
 
 +
 
 +
====Currency====
 +
List the available currency options:
 +
 
 +
<code>bin/magento info:currency:list</code>
 +
 
 +
Eg. to set British Pounds:
 +
 
 +
<code>bin/magento setup:store-config:set --currency GBP</code>
 +
 
 +
 
 +
====Timezone====
 +
List the available timezone options:
 +
 
 +
<code>bin/magento info:timezone:list</code>
 +
 
 +
Eg. to set London UK:
 +
 
 +
<code>bin/magento setup:store-config:set --timezone Europe/London</code>
 +
 
 +
 
 +
===Caches===
 +
 
 +
====Magento Cache====
  
 
While you're in the commandline, may as well enable Magento Caches:
 
While you're in the commandline, may as well enable Magento Caches:
Line 170: Line 447:
 
''config layout block_html collections db_ddl eav full_page translate config_integration config_integration_api config_webservice''
 
''config layout block_html collections db_ddl eav full_page translate config_integration config_integration_api config_webservice''
  
 +
or do the lot - clean & flush the cache, then enable it:
 +
 +
<code>bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 +
 +
====Redis Session & Page Cache====
 +
 +
=====Download Redis, eg. on Centos7=====
 +
 +
<code>sudo yum install epel-release yum-utils</code>
 +
 +
<code>sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm</code>
 +
 +
<code>sudo yum-config-manager --enable remi</code>
 +
 +
=====Install Redis=====
 +
 +
<code>sudo yum install redis</code>
 +
 +
=====Start it, and set to start on server reload=====
 +
 +
<code>sudo systemctl start redis</code>
 +
 +
<code>sudo systemctl enable redis</code>
 +
 +
=====Check Redis is running=====
 +
 +
<code>sudo systemctl status redis</code>
 +
 +
=====Enable Redis for Magento 2 session cache=====
 +
 +
Edit {{folder|app/etc/env.php}}:
 +
 +
<code>
 +
'session' =>
 +
  array (
 +
    'save' => 'redis',
 +
    'redis' =>
 +
        array (
 +
        'host' => '127.0.0.1',
 +
        'port' => '6379',
 +
        'password' => '',
 +
        'timeout' => '5',
 +
        'persistent_identifier' => '',
 +
        'database' => '1',
 +
        'compression_threshold' => '2048',
 +
        'compression_library' => 'gzip',
 +
        'log_level' => '1',
 +
        'max_concurrency' => '6',
 +
        'break_after_frontend' => '5',
 +
        'break_after_adminhtml' => '30',
 +
        'first_lifetime' => '600',
 +
        'bot_first_lifetime' => '60',
 +
        'bot_lifetime' => '7200',
 +
        'disable_locking' => '0',
 +
        'min_lifetime' => '60',
 +
        'max_lifetime' => '2592000'
 +
    )
 +
)
 +
</code>
 +
 +
=====Enable Redis for Magento 2 page cache=====
 +
 +
{{idea|This is a cache for db queries, where Varnish caches page output : use both}}
 +
 +
Edit {{folder|app/etc/env.php}}:
 +
 +
<code>
 +
'cache' =>
 +
  array (
 +
  'frontend' =>
 +
    array (
 +
      'default' =>
 +
        array (
 +
          'backend' => 'Cm_Cache_Backend_Redis',
 +
          'backend_options' =>
 +
            array (
 +
              'server' => '127.0.0.1',
 +
              'port' => '6379',
 +
              'persistent' => 0,
 +
              'database' => '0',
 +
              'force_standalone' => '0',
 +
              'connect_retries' => '10',
 +
              'read_timeout' => '30',
 +
              'automatic_cleaning_factor' => '0',
 +
              'compress_data' => '1',
 +
              'compress_tags' => '1',
 +
              'compress_threshold' => '20480',
 +
              'compression_lib' => 'gzip',
 +
          ),
 +
      ),
 +
  ),
 +
),
 +
</code>
 +
 +
Test with: <code>redis-cli info</code>
  
 
===Enable Developer Mode===
 
===Enable Developer Mode===
Line 176: Line 548:
  
 
<code>php bin/magento deploy:mode:set developer</code>
 
<code>php bin/magento deploy:mode:set developer</code>
 +
 +
===Install Magento 2 Sample Data===
 +
Running a staging or dev site? Let's install the sample data.
 +
 +
{{idea|You can't '''uninstall''' sample data}}
 +
 +
# Switch to developer mode:
 +
#: <code>php bin/magento deploy:mode:set developer</code>
 +
# <code>php bin/magento sampledata:deploy</code>
 +
# <code>php bin/magento setup:upgrade</code>
 +
 +
 +
: ''or, if you're running a cPanel-type setup:''
 +
 +
:# Switch to developer mode:
 +
:#: <code>php -d memory_limit=128M bin/magento deploy:mode:set developer</code>
 +
:# <code>php -d memory_limit=2G bin/magento sampledata:deploy</code>
 +
#: ''It might say 'Authentication required' here, in which case:''
 +
## Login to your magento account
 +
## [https://devdocs.magento.com/guides/v2.3/install-gde/prereq/connect-auth.html Get your auth keys]
 +
## Paste them into the CLI
 +
:# <code>php -d memory_limit=512M bin/magento setup:upgrade</code>
  
 
===Tidy Up Magento 2===
 
===Tidy Up Magento 2===
Line 181: Line 575:
  
 
They might also slow down the store a bit, especially in development phase when your caches are off.
 
They might also slow down the store a bit, especially in development phase when your caches are off.
 +
 +
 +
====Check your installed Magento 2 modules====
  
 
Quick check what you have installed/uninstalled:
 
Quick check what you have installed/uninstalled:
Line 186: Line 583:
 
<code>php bin/magento module:status</code>
 
<code>php bin/magento module:status</code>
  
Here's a couple quick ones you might want to disable:
 
  
<code>bin/magento module:disable Shopial_Facebook</code>
+
====Disable unnecessary Magento 2 modules====
  
''^ fixes the dashboard warning that never goes away "One or more integrations have been reset because of a change to their xml configs"''
+
Removing un-used modules can speed up your site, and make it easier to resolve conflicts. We used to recommend running a command like this:
  
<code>php bin/magento module:disable Magento_SalesAnalytics && php bin/magento module:disable Magento_CustomerAnalytics && php bin/magento module:disable Magento_Analytics && php bin/magento module:disable Magento_QuoteAnalytics && php bin/magento module:disable Magento_ReviewAnalytics && php bin/magento module:disable Magento_CatalogAnalytics && php bin/magento module:disable Magento_WishlistAnalytics</code>
+
<code>bin/magento module:disable Temando_Shipping</code>
  
''^ If you're not using Magento's cloud analytics service, then this will disable it and remove the 'ad' in the dashboard.''
+
Actually it's now recommended to edit the composer.json file in your Magento root, to remove un-used modules, and then run composer update to remove the modules:
  
<code>bin/magento module:disable Temando_Shipping</code>
+
<code>composer update</code>
 +
 
 +
Eg. to remove DHL and FedEx modules:
 +
<code>
 +
    "replace": {
 +
        "magento/module-dhl": "*",
 +
        "magento/module-fedex": "*",
 +
    },
 +
</code>
 +
Keep adding to that block based on what you need/don't need.
 +
 
 +
Here's some ideas:
 +
<code>
 +
        "magento/module-dhl": "*",
 +
        "magento/module-fedex": "*",
 +
        "magento/module-ups": "*",
 +
        "magento/module-usps": "*",
 +
</code>
 +
 
 +
''^ Unless you're offering USPS, UPS< FedEx''
 +
 
 +
<code>
 +
        "magento/module-marketplace": "*",
 +
        "magento/module-persistent": "*",
 +
        "magento/module-catalog-rule-configurable": "*",
 +
        "magento/module-authorizenet": "*",
 +
        "magento/module-google-adwords": "*",
 +
        "magento/module-send-friend": "*",
 +
        "magento/module-swagger": "*",
 +
        "magento/module-swagger-webapi": "*",
 +
        "magento/module-swagger-webapi-async": "*",
 +
</code>
 +
 
 +
<code>
 +
        "magento/module-sample-data": "*",
 +
</code>
 +
 
 +
''^ If you're not running a demo store''
 +
 
 +
 
 +
<code>
 +
        "magento/module-swatches": "*",
 +
        "magento/module-swatches-layered-navigation": "*",
 +
</code>
 +
 
 +
''^ If you're not using swatches, this can be a decent help''
 +
 
 +
<code>
 +
        "magento/module-google-optimizer": "*",
 +
        "magento/module-braintree": "*",
 +
        "magento/module-signifyd": "*",
 +
        "magento/module-release-notification": "*",
 +
        "magento/module-amqp": "*",
 +
        "magento/module-message-queue": "*",
 +
        "magento/module-mysql-mq": "*",
 +
        "magento/module-new-relic-reporting": "*",
 +
        "magento/module-version": "*",
 +
</code>
 +
 
 +
<code>
 +
        "magento/module-analytics": "*",
 +
        "magento/module-catalog-analytics": "*",
 +
        "magento/module-customer-analytics": "*",
 +
        "magento/module-quote-analytics": "*",
 +
        "magento/module-review-analytics": "*",
 +
        "magento/module-sales-analytics": "*",
 +
        "magento/module-wishlist-analytics": "*",
 +
</code>
 +
 
 +
''^ Unless you need [https://docs.magento.com/m2/ce/user_guide/reports/advanced-reporting.html Magento.com's detailed analytics] you can probably remove these''
 +
(Yes, this will get rid of that 'Advanced Reporting' box ad in the Dashboard!)
 +
 
 +
<code>
 +
        "magento/module-bundle-graph-ql": "*",
 +
        "magento/module-catalog-inventory-graph-ql": "*",
 +
        "magento/module-catalog-url-rewrite-graph-ql": "*",
 +
        "magento/module-cms-graph-ql": "*",
 +
        "magento/module-cms-url-rewrite-graph-ql": "*",
 +
        "magento/module-configurable-product-graph-ql": "*",
 +
        "magento/module-downloadable-graph-ql": "*",
 +
        "magento/module-graph-ql": "*",
 +
        "magento/module-grouped-product-graph-ql": "*",
 +
        "magento/module-quote-graph-ql": "*",
 +
        "magento/module-store-graph-ql": "*",
 +
        "magento/module-swatches-graph-ql": "*",
 +
        "magento/module-tax-graph-ql": "*",
 +
        "magento/module-weee-graph-ql": "*",
 +
        "magento/module-advanced-pricing-import-export": "*",
 +
        "magento/module-bundle-import-export": "*",
 +
        "magento/module-configurable-import-export": "*",
 +
        "magento/module-customer-import-export": "*",
 +
        "magento/module-downloadable-import-export": "*",
 +
        "magento/module-grouped-import-export": "*",
 +
        "magento/module-tax-import-export": "*",
 +
</code>
 +
 
 +
<code>
 +
        "magento/module-inventory": "*",
 +
        "magento/module-inventory-admin-ui": "*",
 +
        "magento/module-inventory-api": "*",
 +
        "magento/module-inventory-bundle-product": "*",
 +
        "magento/module-inventory-bundle-product-admin-ui": "*",
 +
        "magento/module-inventory-cache": "*",
 +
        "magento/module-inventory-catalog": "*",
 +
        "magento/module-inventory-catalog-admin-ui": "*",
 +
        "magento/module-inventory-catalog-api": "*",
 +
        "magento/module-inventory-catalog-search": "*",
 +
        "magento/module-inventory-configurable-product": "*",
 +
        "magento/module-inventory-configurable-product-admin-ui": "*",
 +
        "magento/module-inventory-configurable-product-indexer": "*",
 +
        "magento/module-inventory-configuration": "*",
 +
        "magento/module-inventory-configuration-api": "*",
 +
        "magento/module-inventory-elasticsearch": "*",
 +
        "magento/module-inventory-grouped-product": "*",
 +
        "magento/module-inventory-grouped-product-admin-ui": "*",
 +
        "magento/module-inventory-grouped-product-indexer": "*",
 +
        "magento/module-inventory-import-export": "*",
 +
        "magento/module-inventory-indexer": "*",
 +
        "magento/module-inventory-sales": "*",
 +
        "magento/module-inventory-sales-admin-ui": "*",
 +
        "magento/module-inventory-sales-api": "*",
 +
        "magento/module-inventory-sales-frontend-ui": "*",
 +
        "magento/module-inventory-shipping": "*",
 +
        "magento/module-inventory-shipping-admin-ui": "*",
 +
</code>
 +
 
 +
''^ If you're sure you don't need these''
 +
 
 +
<code>
 +
        "magento/module-inventory-low-quantity-notification": "*",
 +
        "magento/module-inventory-low-quantity-notification-admin-ui": "*",
 +
        "magento/module-inventory-low-quantity-notification-api": "*",
 +
        "magento/module-inventory-multi-dimensional-indexer-api": "*",
 +
        "magento/module-inventory-product-alert": "*",
 +
        "magento/module-inventory-reservations": "*",
 +
        "magento/module-inventory-reservations-api": "*",
 +
        "magento/module-inventory-source-deduction-api": "*",
 +
        "magento/module-inventory-source-selection": "*",
 +
        "magento/module-inventory-source-selection-api": "*",
 +
        "magento/module-inventory-distance-based-source-selection": "*",
 +
</code>
 +
 
 +
''^ Depending how you manage inventory you can maybe remove these''
 +
 
 +
<code>"magento/module-wishlist-graph-ql": "*",
 +
"magento/module-sales-graph-ql": "*",
 +
"magento/module-send-friend-graph-ql": "*",
 +
"magento/module-directory-graph-ql": "*",</code>
 +
 
 +
''^ Magento 2.3.1 you can add these''
 +
 
 +
<code>
 +
        "temando/module-shipping-m2": "*",
 +
        "dotmailer/dotmailer-magento2-extension": "*",
 +
        "klarna/module-kp": "*",
 +
        "klarna/module-ordermanagement": "*",
 +
        "klarna/module-core": "*",
 +
        "amzn/amazon-pay-sdk-php": "*",
 +
        "amzn/amazon-pay-and-login-with-amazon-core-module": "*",
 +
        "amzn/login-with-amazon-module": "*",
 +
        "amzn/amazon-pay-module": "*",
 +
        "vertex/module-tax": "*",
 +
        "vertex/sdk": "*",
 +
 
 +
        "msp/recaptcha": "*",
 +
        "msp/two-factor-auth": "*",
 +
        "magento/module-elasticsearch-6": "*",
 +
        "magento/module-webapi-security": "*",
 +
        "magento/module-weee": "*",
 +
        "magento/module-google-analytics": "*",
 +
        "magento/module-product-video": "*",
 +
        "magento/module-send-friend": "*",
 +
        "magento/module-tinymce-3": "*",
 +
        "magento/module-theme-graph-ql": "*",
 +
        "magento/module-catalog-graph-ql": "*",
 +
        "magento/module-customer-graph-ql": "*"
 +
</code>
 +
 
 +
''^ If you don't recognise these, you can probably remove them''
 +
 
 +
=====tldr;=====
 +
 
 +
This is likely to work (double-check you don't need any of the modules first):
 +
 
 +
<code>"replace": {
 +
        "magento/module-dhl": "*",
 +
        "magento/module-fedex": "*",
 +
        "magento/module-ups": "*",
 +
        "magento/module-usps": "*",
 +
        "magento/module-marketplace": "*",
 +
        "magento/module-persistent": "*",
 +
        "magento/module-catalog-rule-configurable": "*",
 +
        "magento/module-authorizenet": "*",
 +
        "magento/module-google-adwords": "*",
 +
        "magento/module-swagger": "*",
 +
        "magento/module-swagger-webapi": "*",
 +
        "magento/module-swagger-webapi-async": "*",
 +
        "magento/module-swatches": "*",
 +
        "magento/module-swatches-layered-navigation": "*",
 +
        "magento/module-google-optimizer": "*",
 +
        "magento/module-braintree": "*",
 +
        "magento/module-signifyd": "*",
 +
        "magento/module-release-notification": "*",
 +
        "magento/module-amqp": "*",
 +
        "magento/module-message-queue": "*",
 +
        "magento/module-mysql-mq": "*",
 +
        "magento/module-new-relic-reporting": "*",
 +
        "magento/module-version": "*",
 +
        "magento/module-analytics": "*",
 +
        "magento/module-catalog-analytics": "*",
 +
        "magento/module-customer-analytics": "*",
 +
        "magento/module-quote-analytics": "*",
 +
        "magento/module-review-analytics": "*",
 +
        "magento/module-sales-analytics": "*",
 +
        "magento/module-wishlist-analytics": "*",
 +
        "magento/module-bundle-graph-ql": "*",
 +
        "magento/module-catalog-inventory-graph-ql": "*",
 +
        "magento/module-catalog-url-rewrite-graph-ql": "*",
 +
        "magento/module-cms-graph-ql": "*",
 +
        "magento/module-cms-url-rewrite-graph-ql": "*",
 +
        "magento/module-configurable-product-graph-ql": "*",
 +
        "magento/module-downloadable-graph-ql": "*",
 +
        "magento/module-graph-ql": "*",
 +
        "magento/module-grouped-product-graph-ql": "*",
 +
        "magento/module-quote-graph-ql": "*",
 +
        "magento/module-store-graph-ql": "*",
 +
        "magento/module-swatches-graph-ql": "*",
 +
        "magento/module-tax-graph-ql": "*",
 +
        "magento/module-weee-graph-ql": "*",
 +
        "magento/module-advanced-pricing-import-export": "*",
 +
        "magento/module-bundle-import-export": "*",
 +
        "magento/module-configurable-import-export": "*",
 +
        "magento/module-customer-import-export": "*",
 +
        "magento/module-downloadable-import-export": "*",
 +
        "magento/module-grouped-import-export": "*",
 +
        "magento/module-tax-import-export": "*",
 +
        "magento/module-wishlist-graph-ql": "*",
 +
        "magento/module-sales-graph-ql": "*",
 +
        "magento/module-send-friend-graph-ql": "*",
 +
        "magento/module-directory-graph-ql": "*",
 +
        "temando/module-shipping-m2": "*",
 +
        "dotmailer/dotmailer-magento2-extension": "*",
 +
        "klarna/module-kp": "*",
 +
        "klarna/module-ordermanagement": "*",
 +
        "klarna/module-core": "*",
 +
        "amzn/amazon-pay-sdk-php": "*",
 +
        "amzn/amazon-pay-and-login-with-amazon-core-module": "*",
 +
        "amzn/login-with-amazon-module": "*",
 +
        "amzn/amazon-pay-module": "*",
 +
        "vertex/module-tax": "*",
 +
        "vertex/sdk": "*",
 +
        "magento/module-inventory-pi": "*",
 +
        "magento/module-inventory-catalog-api": "*",
 +
        "magento/module-inventory-configuration": "*",
 +
        "magento/module-inventory-configuration-api": "*",
 +
        "magento/module-inventory-distance-based-source-selection": "*",
 +
        "magento/module-inventory-distance-based-source-selection-adminUi": "*",
 +
        "magento/module-inventory-distance-based-source-selection-api": "*",
 +
        "magento/module-inventory-elasticsearch": "*",
 +
        "magento/module-inventory-import-export": "*",
 +
        "magento/module-inventory-low-quantity-notification": "*",
 +
        "magento/module-inventory-low-quantity-notification-admin-ui": "*",
 +
        "magento/module-inventory-low-quantity-notification-api": "*",
 +
        "magento/module-inventory-multi-dimensional-indexer-api": "*",
 +
        "magento/module-inventory-product-alert": "*",
 +
        "magento/module-inventory-reservations": "*",
 +
        "magento/module-inventory-reservations-api": "*",
 +
        "magento/module-inventory-sales-api": "*",
 +
        "magento/module-inventory-setup-fixture-generator": "*",
 +
        "magento/module-inventory-source-deduction-api": "*",
 +
        "magento/module-inventory-source-selection": "*",
 +
        "magento/module-inventory-source-selection-api": "*",
 +
        "magento/module-inventory-configurable-product-indexer" : "*",
 +
        "msp/recaptcha": "*",
 +
        "msp/two-factor-auth": "*",
 +
        "magento/module-elasticsearch-6": "*",
 +
        "magento/module-webapi-security": "*",
 +
        "magento/module-weee": "*",
 +
        "magento/module-google-analytics": "*",
 +
        "magento/module-product-video": "*",
 +
        "magento/module-send-friend": "*",
 +
        "magento/module-tinymce-3": "*",
 +
        "magento/module-theme-graph-ql": "*",
 +
        "magento/module-catalog-graph-ql": "*",
 +
        "magento/module-customer-graph-ql": "*"
 +
},</code>
 +
 
 +
====Refresh the install====
 +
Don't forget to run the usual Magento 2 refresh commands here:
 +
 
 +
<code>composer update</code>
 +
 
 +
''^ if you haven't already after updating composer.json''
 +
 
 +
<code>php bin/magento maintenance:enable</code>
 +
 
 +
<code>php bin/magento setup:upgrade</code>
 +
 
 +
<code>php bin/magento setup:di:compile</code>
 +
 
 +
<code>php bin/magento setup:db-schema:upgrade</code>
 +
 
 +
<code>php bin/magento indexer:reindex</code>
 +
 
 +
<code>php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code>
 +
 
 +
<code>php bin/magento maintenance:disable</code>
 +
 
 +
'': Or, if you need to specify a higher memory allocation :''
 +
 
 +
: <code>php -dallow_url_fopen=On -dmemory_limit=512M composer.phar update</code>
 +
 
 +
: <code>php bin/magento maintenance:enable</code>
 +
 
 +
: <code>php -dmemory_limit=256M bin/magento setup:upgrade</code>
 +
 
 +
: <code>php -dmemory_limit=512M bin/magento setup:di:compile</code>
 +
 
 +
: <code>php -dmemory_limit=128M bin/magento setup:db-schema:upgrade</code>
  
''^ Unless you're shipping in Australia''
+
: <code>php -dmemory_limit=256M bin/magento indexer:reindex && php -dmemory_limit=128M bin/magento cache:clean && php -dmemory_limit=128M bin/magento cache:flush && php -dmemory_limit=128M bin/magento cache:enable</code>
  
<code>bin/magento module:disable Dotdigitalgroup_Email</code>
+
: <code>php -dmemory_limit=128M bin/magento maintenance:disable</code>
  
''^ Unless you're using dotMailer''
 
  
<code>bin/magento module:disable Magento_Usps && bin/magento module:disable Magento_Ups && bin/magento module:disable Magento_Fedex && bin/magento module:disable Magento_Dhl</code>
+
'': Or, if you're in a cPanel type setup and need to force a PHP version :''
  
''^ Unless you're offering USPS, UPS< FedEx''
+
: <code>php -dallow_url_fopen=On -dmemory_limit=512M -ea_php 71 composer.phar update</code>
  
<code>bin/magento module:disable Magento_NewRelicReporting</code>
+
: <code>php bin/magento maintenance:enable</code>
  
''^ Unless you're using NewRelic to monitor your app/server''
+
: <code>php -dmemory_limit=256M -ea_php 71 bin/magento setup:upgrade</code>
  
<code>bin/magento module:disable Magento_SampleData</code>
+
: <code>php -dmemory_limit=512M -ea_php 71 bin/magento setup:di:compile</code>
  
''^ If you're not using the Magento Sample Data to test a setup''
+
: <code>php -dmemory_limit=128M -ea_php 71 bin/magento setup:db-schema:upgrade</code>
  
<code>bin/magento module:disable Magento_Marketplace</code>
+
: <code>php -dmemory_limit=256M -ea_php 71 bin/magento indexer:reindex && php -dmemory_limit=128M -ea_php 71 bin/magento cache:clean && php -dmemory_limit=128M -ea_php 71 bin/magento cache:flush && php -dmemory_limit=128M -ea_php 71 bin/magento cache:enable</code>
  
''^ If you don't need in-site access to the Magento Marketplace site''
+
: <code>php -dmemory_limit=128M -ea_php 71 bin/magento maintenance:disable</code>
  
===Enable Demo Store Notice on Magento 2===
+
===Show the Demo Store Notice on Magento 2===
  
 
If you're not yet live, or have a dev and live server, it's helpful to visually separate live vs dev with a demo store 'hello bar'.
 
If you're not yet live, or have a dev and live server, it's helpful to visually separate live vs dev with a demo store 'hello bar'.

Latest revision as of 14:07, 4 July 2021

Contents

Magento Setup Help

If you've just installed Magento and are having issues, first step is to check some basic things.

You might also want to check the official guide.

Check PHP Version

Acceptable PHP Versions for Magento 2

First up, Magento 2 won't work with some versions.

Here's the current list of accepted versions, for Magento 2.4:

7.4 : Too easy!

(Not: 7.4.2) (You can use 7.3 but it's not tested or recommended).

And for Magento 2.3:

acceptable-magento-versions-magento-23.png

And for Magento 2.2:

acceptable-magento-versions.png

Check the official requirements list here.

Running Magento 2 Locally

If you're running this locally, if you're using something like MAMP, check in the settings:

magento-mamp-php-versions.png

If the version showing as installed doesn't match one of the above accepted versions, change it before continuing.

Check Commandline PHP Version

Type: php -v

You should see something like this:

PHP 7.1.12 (cli) (built: Nov 27 2017 15:53:40) ( NTS )

Copyright (c) 1997-2017 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies

with Zend OPcache v7.1.12, Copyright (c) 1999-2017, by Zend Technologies

First, if you're running Magento locally, and using something like MAMP, check the versions match.

If they don't then time to fix.

Remote / cPanel-type install
If you're running on something like cPanel, then you might find the CommandLineInterface doesn't use the 'correct' version of PHP.
You can then specify the specific version to use, eg.:
php -ea_php 74 -v
eg. here we're specifying to use php7.4 when running the command '-v' (= 'check php version')


Local / MAMP-type install
We want to get the commandline to use MAMP's version.
1. Edit the system settings to tell it to get PHP from the MAMP version:
nano ~/.bash_profile
Add this line, editing the php version to match whatever you have selected in MAMP:
alias phpmamp='/Applications/MAMP/bin/php7.1.12/bin/php'
2. Check where the local system is getting php from:
which php
which should return something like:
/usr/local/bin/php
3. Backup this php, using the path from (2):
sudo mv /usr/local/bin/php /usr/local/bin/php.bak
4. Make an alias to the MAMP PHP version, using the path from (2) and the PHP version from MAMP:
sudo ln -s /Applications/MAMP/bin/php/php7.1.12/bin/php /usr/local/bin/php
5. Reload the new settings:
source ~/.bash_profile
6. Check the new version is sticking:
php -v

Make Initial PHP Settings

Magento needs some minimum system resources. PHP by default will have 128MB of memory allocated. We want more!

Find In-use PHP Settings File (php.ini)

Type: php -r 'phpinfo();' | grep 'php.ini'

Should return something like:

/Applications/MAMP/bin/php/php7.1.12/conf/php.ini


Edit PHP Settings for Magento 2

  • These are basic settings for a new test install.
  • If you're running a live site these will be different!

1. Find that file from above and edit in a text editor.

2. Look for these settings and change them if they're different.

Uncomment (remove the semicolon from the start of the line) if needed.

memory_limit = 2G

^ You might be able to deal with 1G, but for things like updating Magento you might need the 2G.

date.timezone = "Asia/Bangkok"

^ Set this to match your local machine (if running local), or the server timezone.

always_populate_raw_post_data = -1

Uncomment this line:

zend_extension="...

eg:

zend_extension="/Applications/MAMP/bin/php/php7.4.2/lib/php/extensions/no-debug-non-zts-20170718/opcache.so"

Add this line near the above line:

opcache.save_comments=1

^ This turns on PHP caching which will make decent improvements to the speed Magento runs at.

PHP Extensions for Magento 2

Find php.ini in your system.

which php

For MAMP it'll be eg: /Applications/MAMP/bin/php/php7.4.2/conf/php.ini

Open that and remove the semicolon ; from ;extension=php_intl.dll

Edit your bash_profile to check paths:

nano ~/.bash_profile

Then check you have the correct paths to your PHP version. Eg. in MAMP:

alias phpmamp='/Applications/MAMP/bin/php7.4.2/bin/php'

alias php='/Applications/MAMP/bin/php/php7.4.2/bin/php'

export PATH="/usr/local/bin:/usr/local/sbin:/Applications/MAMP/bin/php/php7.4.2/bin:$PATH"

Then reload:

. ~/.bash_profile

Check PHP Version

Finally check the running PHP version:

php -v

Check file/folder ownership/permissions

Background

List all users in the system:

compgen -u

^ The user you want to assign magento ownership to should be in here

In 1-user (eg. cPanel) setups

  1. Navigate to the magento install folder (the one with /app /var etc. in) in eg. FIleZilla,
    or via CLI eg. cd public_html/example_site.com
  2. Check write permissions are set for these folders:
    1. vendor
    2. app/etc
    3. pub/static
    4. var
    5. generated
    6. {any other static resources}
  3. If you need to change those permissions, use either FileZilla again,
    or via CLI eg.
    find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {}
    find var vendor pub/static pub/media app/etc -type d -exec chmod g+w {}
    chmod u+x bin/magento
  4. Check file/folder permissions
    In general the recommended permissions are 644 for files, 755 for folders.
    If the previous steps didn't work for you, give this a go:
    find . -type f -exec chmod 644 {} \;
    find . -type d -exec chmod 755 {} \;

In 2-user (eg. VPS) setups

  1. Switch to the Main system user (usually not the Magento file system user)
    CentOS: su - {username, eg. magento_user}
    Ubuntu: su {username, eg. magento_user}
  2. Make the user that will be the Magento file system user:
    sudo adduser {username}
    (Replacing {username} with the actual name for this user you want to create, eg. 'magento_user')
  3. Give that user a password:
    sudo passwd {username, eg. magento_user}
  4. Find the web server user (usually 'apache' in CentOs, or 'www-data' in Ubuntu):
    CentOS: grep -E -i '^user|^group' /etc/httpd/conf/httpd.conf
    Ubuntu: ps aux | grep apache to find the user, then groups {apache user} to find the group
  5. Move the Magento file system user in the web server user group:
    CentOS: sudo usermod -a -G apache {username}
    Ubuntu: sudo usermod -a -G www-data {username}
    eg. in CentOS: sudo usermod -a -G apache magento_user
    ^ Assuming the web server user you found earlier is "apache" or "www-data"
  6. Check your Magento file system user is in the web server user group:
    groups magento_user
    eg. this would mean primary is 'magento' and secondary is 'apache': magento_user : magento_user apache
  7. Restart the server:
    CentOS: service httpd restart
    Ubuntu: service apache2 restart
  8. Switch to the Magento file system user
    CentOS: su - {username, eg. magento_user}
    Ubuntu: su {username, eg. magento_user}
  9. While logged in to the server as the Magento file system user, navigate to the Magento install folder, then set the ownership/permissions:
    find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + && find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
    sudo chown -R :{web server group, eg. apache} .
    chmod u+x bin/magento

Check Magento 2 Version

php bin/magento --version

Update Magento 2.4.x Version

  1. Check you have elasticsearch running - this is a new requirement with 2.4+
  2. Show the maintenance page
    php bin/magento maintenance:enable
  3. Install composer update plugin:
    composer require magento/composer-root-update-plugin=~1.0 --no-update
    composer update
  4. Update to a specific version
    composer require magento/product-community-edition 2.4.2 --no-update
    composer update
    If you get an error like "Your requirements could not be resolved to an installable set of packages", try this
    composer update --ignore-platform-reqs
    If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:
    curl -sS https://getcomposer.org/installer | php -d allow_url_fopen=On
    php composer.phar require magento/product-community-edition 2.4.2 --no-update
    php -d memory_limit=-1 composer.phar update
  5. Update database
    php bin/magento setup:upgrade
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 74 bin/magento setup:upgrade
  6. Recompile
    php bin/magento setup:di:compile
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 74 bin/magento setup:di:compile
  7. Refresh indexes & clear the cache
    php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 74 bin/magento indexer:reindex && php -d memory_limit=1G -ea_php 74 bin/magento cache:clean && php -d memory_limit=1G -ea_php 73 bin/magento cache:flush && php -d memory_limit=1G -ea_php 74 bin/magento cache:enable
  8. Hide the maintenance page
    php bin/magento maintenance:disable
  9. Check version
    php bin/magento --version
    or, on a cPanel-type setup:
    php -ea_php 74 bin/magento --version

Update Magento 2.3.x Version

  1. Show the maintenance page
    php bin/magento maintenance:enable
  2. Update to a specific version
    composer require magento/product-community-edition 2.3.5 --no-update
    composer update
    If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:
    curl -sS https://getcomposer.org/installer | php -d allow_url_fopen=On
    php composer.phar require magento/product-community-edition 2.3.5 --no-update
    php -d memory_limit=-1 composer.phar update
  3. Update database
    php bin/magento setup:upgrade
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 73 bin/magento setup:upgrade
  4. Recompile
    php bin/magento setup:di:compile
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 73 bin/magento setup:di:compile
  5. Refresh indexes & clear the cache
    php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=1G -ea_php 73 bin/magento indexer:reindex && php -d memory_limit=1G -ea_php 73 bin/magento cache:clean && php -d memory_limit=1G -ea_php 73 bin/magento cache:flush && php -d memory_limit=1G -ea_php 73 bin/magento cache:enable
  6. Hide the maintenance page
    php bin/magento maintenance:disable
  7. Check version
    php bin/magento --version
    or, on a cPanel-type setup:
    php -ea_php 73 bin/magento --version

Update to Magento 2.3 from 2.2.x

Magento 2.3 has a minimum PHP version 7.1.3 or 7.2.x : check that first!

  1. Show the maintenance page
    php -d memory_limit=128M bin/magento maintenance:enable
  2. Make some changes to composer.json to deal with the new version:
    composer remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update
    composer require --dev friendsofphp/php-cs-fixer:~2.10.1 --no-update
    composer require --dev sebastian/phpcpd:~3.0.0 --no-update
    composer require --dev phpunit/phpunit:~6.2.0 --no-update
    composer require --dev lusitanian/oauth:~0.8.10 --no-update
    composer require --dev pdepend/pdepend:2.5.2 --no-update
    composer require --dev squizlabs/php_codesniffer:3.2.2 --no-update
    If you're running on a cPanel-type setup, you might need:
    php -d allow_url_fopen=On composer.phar remove --dev sjparkinson/static-review fabpot/php-cs-fixer --no-update
    php -d allow_url_fopen=On composer.phar require --dev friendsofphp/php-cs-fixer:~2.10.1 --no-update
    php -d allow_url_fopen=On composer.phar require --dev sebastian/phpcpd:~3.0.0 --no-update
    php -d allow_url_fopen=On composer.phar require --dev phpunit/phpunit:~6.2.0 --no-update
    php -d allow_url_fopen=On composer.phar require --dev lusitanian/oauth:~0.8.10 --no-update
    php -d allow_url_fopen=On composer.phar require --dev pdepend/pdepend:2.5.2 --no-update
    php -d allow_url_fopen=On composer.phar require --dev squizlabs/php_codesniffer:3.2.2 --no-update
    php -r '$autoload=json_decode(file_get_contents("composer.json"), true); $autoload["autoload"]["psr-4"]["Zend\\Mvc\\Controller\\"]= "setup/src/Zend/Mvc/Controller/"; file_put_contents("composer.json", json_encode($autoload, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));'
  3. Update to a specific version
    composer require magento/product-community-edition 2.3 --no-update
    composer update
    If you're running on a cPanel-type setup, you might find it easier to install/run a local version of composer:
    curl -sS https://getcomposer.org/installer | php
    php composer.phar require magento/product-community-edition 2.3 --no-update
    php -d allow_url_fopen=On -d memory_limit=128M -ea_php 72 composer.phar update
  4. Update database
    php bin/magento setup:upgrade
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=128M -ea_php 72 bin/magento setup:upgrade
  5. Recompile
    php bin/magento setup:di:compile
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=512M -ea_php 72 bin/magento setup:di:compile
  6. Refresh indexes & clear the cache
    php bin/magento indexer:reindex && php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable
    If you're running on a cPanel-type setup, you might need to specifically reference a magento-valid php version:
    php -d memory_limit=512M -ea_php 72 bin/magento indexer:reindex && php -d memory_limit=512M -ea_php 72 bin/magento cache:clean && php -d memory_limit=512M -ea_php 72 bin/magento cache:flush && php -d memory_limit=512M -ea_php 72 bin/magento cache:enable
  7. Hide the maintenance page
    php -d memory_limit=128M bin/magento maintenance:disable
  8. Check version
    php bin/magento --version
    or, on a cPanel-type setup:
    php -ea_php 72 bin/magento --version

Check https

Check your cert

First check that you have installed your SSH cert correctly.

  1. Go to https://{your site domain}
  2. Click the lock on the left of the URL
  3. Check it shows valid

Set your Magento config to point to https

These will set default values - for a multi-site setup you'll need to edit this
bin/magento setup:store-config:set --use-secure 1
bin/magento setup:store-config:set --use-secure-admin 1
bin/magento setup:store-config:set --base-url "https://{your site domain}/"
bin/magento setup:store-config:set --base-url-secure "https://{your site domain}/"
* If your magento install isn't in the public root, add that path after your domain in the commands above (don't miss the trailing slash)

Check non-https auto-redirects to https

  1. Go to http://{your site domain}
  2. It should redirect to https://{your site domain}

Check cron runs via CLI

php bin/magento cron:run

If needed, setup Magento cron

Run crontab -e to see & edit what crons are being run on the server.

Check you have these 3 Magento crons set:

* * * * * php {magento install dir}/bin/magento cron:run | grep -v "Ran jobs by schedule" >> {magento install dir}/var/log/magento.cron.log

* * * * * php {magento install dir}/update/cron.php >> {magento install dir}/var/log/update.cron.log

* * * * * php {magento install dir}/bin/magento setup:cron:run >> {magento install dir}/var/log/setup.cron.log

If you're running a dev site, consider setting the cron to run every 15 mins: */15 * * * *

Set language, currency, timezone

These will set default values - for a multi-site setup you'll need to edit this

Language

List the available language options:

bin/magento info:language:list

Eg. to set French:

bin/magento setup:store-config:set --language fr_FR


Currency

List the available currency options:

bin/magento info:currency:list

Eg. to set British Pounds:

bin/magento setup:store-config:set --currency GBP


Timezone

List the available timezone options:

bin/magento info:timezone:list

Eg. to set London UK:

bin/magento setup:store-config:set --timezone Europe/London


Caches

Magento Cache

While you're in the commandline, may as well enable Magento Caches:

bin/magento cache:enable

You can selectively enable/disable caches by adding from :

config layout block_html collections db_ddl eav full_page translate config_integration config_integration_api config_webservice

or do the lot - clean & flush the cache, then enable it:

bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable

Redis Session & Page Cache

Download Redis, eg. on Centos7

sudo yum install epel-release yum-utils

sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm

sudo yum-config-manager --enable remi

Install Redis

sudo yum install redis

Start it, and set to start on server reload

sudo systemctl start redis

sudo systemctl enable redis

Check Redis is running

sudo systemctl status redis

Enable Redis for Magento 2 session cache

Edit app/etc/env.php:

'session' =>

  array (
    'save' => 'redis',
    'redis' => 
       array (
        'host' => '127.0.0.1',
        'port' => '6379',
        'password' => ,
        'timeout' => '5',
        'persistent_identifier' => ,
        'database' => '1',
        'compression_threshold' => '2048',
        'compression_library' => 'gzip',
        'log_level' => '1',
        'max_concurrency' => '6',
        'break_after_frontend' => '5',
        'break_after_adminhtml' => '30',
        'first_lifetime' => '600',
        'bot_first_lifetime' => '60',
        'bot_lifetime' => '7200',
        'disable_locking' => '0',
        'min_lifetime' => '60',
        'max_lifetime' => '2592000'
   )

)

Enable Redis for Magento 2 page cache

This is a cache for db queries, where Varnish caches page output : use both

Edit app/etc/env.php:

'cache' =>

 array (
 'frontend' =>
   array (
     'default' =>
       array (
         'backend' => 'Cm_Cache_Backend_Redis',
          'backend_options' =>
           array (
             'server' => '127.0.0.1',
             'port' => '6379',
             'persistent' => 0,
             'database' => '0',
             'force_standalone' => '0',
             'connect_retries' => '10',
             'read_timeout' => '30',
             'automatic_cleaning_factor' => '0',
             'compress_data' => '1',
             'compress_tags' => '1',
             'compress_threshold' => '20480',
             'compression_lib' => 'gzip',
         ),
     ),
  ),

),

Test with: redis-cli info

Enable Developer Mode

If you're running a local test install, or have a live dev server, check you've got developer mode enabled:

php bin/magento deploy:mode:set developer

Install Magento 2 Sample Data

Running a staging or dev site? Let's install the sample data.

You can't uninstall sample data

  1. Switch to developer mode:
    php bin/magento deploy:mode:set developer
  2. php bin/magento sampledata:deploy
  3. php bin/magento setup:upgrade


or, if you're running a cPanel-type setup:
  1. Switch to developer mode:
    php -d memory_limit=128M bin/magento deploy:mode:set developer
  2. php -d memory_limit=2G bin/magento sampledata:deploy
  1. It might say 'Authentication required' here, in which case:
    1. Login to your magento account
    2. Get your auth keys
    3. Paste them into the CLI
  1. php -d memory_limit=512M bin/magento setup:upgrade

Tidy Up Magento 2

Magento 2 comes with a couple modules that you'll probably not use, some of which annoyingly provide warnings in the Dashboard!

They might also slow down the store a bit, especially in development phase when your caches are off.


Check your installed Magento 2 modules

Quick check what you have installed/uninstalled:

php bin/magento module:status


Disable unnecessary Magento 2 modules

Removing un-used modules can speed up your site, and make it easier to resolve conflicts. We used to recommend running a command like this:

bin/magento module:disable Temando_Shipping

Actually it's now recommended to edit the composer.json file in your Magento root, to remove un-used modules, and then run composer update to remove the modules:

composer update

Eg. to remove DHL and FedEx modules:

   "replace": {
       "magento/module-dhl": "*",
       "magento/module-fedex": "*",
   },

Keep adding to that block based on what you need/don't need.

Here's some ideas:

       "magento/module-dhl": "*",
       "magento/module-fedex": "*",
       "magento/module-ups": "*",
       "magento/module-usps": "*",

^ Unless you're offering USPS, UPS< FedEx

       "magento/module-marketplace": "*",
       "magento/module-persistent": "*",
       "magento/module-catalog-rule-configurable": "*",
       "magento/module-authorizenet": "*",
       "magento/module-google-adwords": "*",
       "magento/module-send-friend": "*",
       "magento/module-swagger": "*",
       "magento/module-swagger-webapi": "*",
       "magento/module-swagger-webapi-async": "*",

       "magento/module-sample-data": "*",

^ If you're not running a demo store


       "magento/module-swatches": "*",
       "magento/module-swatches-layered-navigation": "*",

^ If you're not using swatches, this can be a decent help

       "magento/module-google-optimizer": "*",
       "magento/module-braintree": "*",
       "magento/module-signifyd": "*",
       "magento/module-release-notification": "*",
       "magento/module-amqp": "*",
       "magento/module-message-queue": "*",
       "magento/module-mysql-mq": "*",
       "magento/module-new-relic-reporting": "*",
       "magento/module-version": "*",

       "magento/module-analytics": "*",
       "magento/module-catalog-analytics": "*",
       "magento/module-customer-analytics": "*",
       "magento/module-quote-analytics": "*",
       "magento/module-review-analytics": "*",
       "magento/module-sales-analytics": "*",
       "magento/module-wishlist-analytics": "*",

^ Unless you need Magento.com's detailed analytics you can probably remove these (Yes, this will get rid of that 'Advanced Reporting' box ad in the Dashboard!)

       "magento/module-bundle-graph-ql": "*",
       "magento/module-catalog-inventory-graph-ql": "*",
       "magento/module-catalog-url-rewrite-graph-ql": "*",
       "magento/module-cms-graph-ql": "*",
       "magento/module-cms-url-rewrite-graph-ql": "*",
       "magento/module-configurable-product-graph-ql": "*",
       "magento/module-downloadable-graph-ql": "*",
       "magento/module-graph-ql": "*",
       "magento/module-grouped-product-graph-ql": "*",
       "magento/module-quote-graph-ql": "*",
       "magento/module-store-graph-ql": "*",
       "magento/module-swatches-graph-ql": "*",
       "magento/module-tax-graph-ql": "*",
       "magento/module-weee-graph-ql": "*",
       "magento/module-advanced-pricing-import-export": "*",
       "magento/module-bundle-import-export": "*",
       "magento/module-configurable-import-export": "*",
       "magento/module-customer-import-export": "*",
       "magento/module-downloadable-import-export": "*",
       "magento/module-grouped-import-export": "*",
       "magento/module-tax-import-export": "*",

       "magento/module-inventory": "*",
       "magento/module-inventory-admin-ui": "*",
       "magento/module-inventory-api": "*",
       "magento/module-inventory-bundle-product": "*",
       "magento/module-inventory-bundle-product-admin-ui": "*",
       "magento/module-inventory-cache": "*",
       "magento/module-inventory-catalog": "*",
       "magento/module-inventory-catalog-admin-ui": "*",
       "magento/module-inventory-catalog-api": "*",
       "magento/module-inventory-catalog-search": "*",
       "magento/module-inventory-configurable-product": "*",
       "magento/module-inventory-configurable-product-admin-ui": "*",
       "magento/module-inventory-configurable-product-indexer": "*",
       "magento/module-inventory-configuration": "*",
       "magento/module-inventory-configuration-api": "*",
       "magento/module-inventory-elasticsearch": "*",
       "magento/module-inventory-grouped-product": "*",
       "magento/module-inventory-grouped-product-admin-ui": "*",
       "magento/module-inventory-grouped-product-indexer": "*",
       "magento/module-inventory-import-export": "*",
       "magento/module-inventory-indexer": "*",
       "magento/module-inventory-sales": "*",
       "magento/module-inventory-sales-admin-ui": "*",
       "magento/module-inventory-sales-api": "*",
       "magento/module-inventory-sales-frontend-ui": "*",
       "magento/module-inventory-shipping": "*",
       "magento/module-inventory-shipping-admin-ui": "*",

^ If you're sure you don't need these

       "magento/module-inventory-low-quantity-notification": "*",
       "magento/module-inventory-low-quantity-notification-admin-ui": "*",
       "magento/module-inventory-low-quantity-notification-api": "*",
       "magento/module-inventory-multi-dimensional-indexer-api": "*",
       "magento/module-inventory-product-alert": "*",
       "magento/module-inventory-reservations": "*",
       "magento/module-inventory-reservations-api": "*",
       "magento/module-inventory-source-deduction-api": "*",
       "magento/module-inventory-source-selection": "*",
       "magento/module-inventory-source-selection-api": "*",
       "magento/module-inventory-distance-based-source-selection": "*",

^ Depending how you manage inventory you can maybe remove these

"magento/module-wishlist-graph-ql": "*", "magento/module-sales-graph-ql": "*", "magento/module-send-friend-graph-ql": "*", "magento/module-directory-graph-ql": "*",

^ Magento 2.3.1 you can add these

       "temando/module-shipping-m2": "*",
       "dotmailer/dotmailer-magento2-extension": "*",
       "klarna/module-kp": "*",
       "klarna/module-ordermanagement": "*",
       "klarna/module-core": "*",
       "amzn/amazon-pay-sdk-php": "*",
       "amzn/amazon-pay-and-login-with-amazon-core-module": "*",
       "amzn/login-with-amazon-module": "*",
       "amzn/amazon-pay-module": "*",
       "vertex/module-tax": "*",
       "vertex/sdk": "*",
       "msp/recaptcha": "*",
       "msp/two-factor-auth": "*",
       "magento/module-elasticsearch-6": "*",
       "magento/module-webapi-security": "*",
       "magento/module-weee": "*",
       "magento/module-google-analytics": "*",
       "magento/module-product-video": "*",
       "magento/module-send-friend": "*",
       "magento/module-tinymce-3": "*",
       "magento/module-theme-graph-ql": "*",
       "magento/module-catalog-graph-ql": "*",
       "magento/module-customer-graph-ql": "*"

^ If you don't recognise these, you can probably remove them

tldr;

This is likely to work (double-check you don't need any of the modules first):

"replace": {

       "magento/module-dhl": "*",
       "magento/module-fedex": "*",
       "magento/module-ups": "*",
       "magento/module-usps": "*",
       "magento/module-marketplace": "*",
       "magento/module-persistent": "*",
       "magento/module-catalog-rule-configurable": "*",
       "magento/module-authorizenet": "*",
       "magento/module-google-adwords": "*",
       "magento/module-swagger": "*",
       "magento/module-swagger-webapi": "*",
       "magento/module-swagger-webapi-async": "*",
       "magento/module-swatches": "*",
       "magento/module-swatches-layered-navigation": "*",
       "magento/module-google-optimizer": "*",
       "magento/module-braintree": "*",
       "magento/module-signifyd": "*",
       "magento/module-release-notification": "*",
       "magento/module-amqp": "*",
       "magento/module-message-queue": "*",
       "magento/module-mysql-mq": "*",
       "magento/module-new-relic-reporting": "*",
       "magento/module-version": "*",
       "magento/module-analytics": "*",
       "magento/module-catalog-analytics": "*",
       "magento/module-customer-analytics": "*",
       "magento/module-quote-analytics": "*",
       "magento/module-review-analytics": "*",
       "magento/module-sales-analytics": "*",
       "magento/module-wishlist-analytics": "*",
       "magento/module-bundle-graph-ql": "*",
       "magento/module-catalog-inventory-graph-ql": "*",
       "magento/module-catalog-url-rewrite-graph-ql": "*",
       "magento/module-cms-graph-ql": "*",
       "magento/module-cms-url-rewrite-graph-ql": "*",
       "magento/module-configurable-product-graph-ql": "*",
       "magento/module-downloadable-graph-ql": "*",
       "magento/module-graph-ql": "*",
       "magento/module-grouped-product-graph-ql": "*",
       "magento/module-quote-graph-ql": "*",
       "magento/module-store-graph-ql": "*",
       "magento/module-swatches-graph-ql": "*",
       "magento/module-tax-graph-ql": "*",
       "magento/module-weee-graph-ql": "*",
       "magento/module-advanced-pricing-import-export": "*",
       "magento/module-bundle-import-export": "*",
       "magento/module-configurable-import-export": "*",
       "magento/module-customer-import-export": "*",
       "magento/module-downloadable-import-export": "*",
       "magento/module-grouped-import-export": "*",
       "magento/module-tax-import-export": "*",
       "magento/module-wishlist-graph-ql": "*",
       "magento/module-sales-graph-ql": "*",
       "magento/module-send-friend-graph-ql": "*",
       "magento/module-directory-graph-ql": "*",
       "temando/module-shipping-m2": "*",
       "dotmailer/dotmailer-magento2-extension": "*",
       "klarna/module-kp": "*",
       "klarna/module-ordermanagement": "*",
       "klarna/module-core": "*",
       "amzn/amazon-pay-sdk-php": "*",
       "amzn/amazon-pay-and-login-with-amazon-core-module": "*",
       "amzn/login-with-amazon-module": "*",
       "amzn/amazon-pay-module": "*",
       "vertex/module-tax": "*",
       "vertex/sdk": "*",
       "magento/module-inventory-pi": "*",
       "magento/module-inventory-catalog-api": "*",
       "magento/module-inventory-configuration": "*",
       "magento/module-inventory-configuration-api": "*",
       "magento/module-inventory-distance-based-source-selection": "*",
       "magento/module-inventory-distance-based-source-selection-adminUi": "*",
       "magento/module-inventory-distance-based-source-selection-api": "*",
       "magento/module-inventory-elasticsearch": "*",
       "magento/module-inventory-import-export": "*",
       "magento/module-inventory-low-quantity-notification": "*",
       "magento/module-inventory-low-quantity-notification-admin-ui": "*",
       "magento/module-inventory-low-quantity-notification-api": "*",
       "magento/module-inventory-multi-dimensional-indexer-api": "*",
       "magento/module-inventory-product-alert": "*",
       "magento/module-inventory-reservations": "*",
       "magento/module-inventory-reservations-api": "*",
       "magento/module-inventory-sales-api": "*",
       "magento/module-inventory-setup-fixture-generator": "*",
       "magento/module-inventory-source-deduction-api": "*",
       "magento/module-inventory-source-selection": "*",
       "magento/module-inventory-source-selection-api": "*",
       "magento/module-inventory-configurable-product-indexer" : "*",
       "msp/recaptcha": "*",
       "msp/two-factor-auth": "*",
       "magento/module-elasticsearch-6": "*",
       "magento/module-webapi-security": "*",
       "magento/module-weee": "*",
       "magento/module-google-analytics": "*",
       "magento/module-product-video": "*",
       "magento/module-send-friend": "*",
       "magento/module-tinymce-3": "*",
       "magento/module-theme-graph-ql": "*",
       "magento/module-catalog-graph-ql": "*",
       "magento/module-customer-graph-ql": "*"

},

Refresh the install

Don't forget to run the usual Magento 2 refresh commands here:

composer update

^ if you haven't already after updating composer.json

php bin/magento maintenance:enable

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:db-schema:upgrade

php bin/magento indexer:reindex

php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable

php bin/magento maintenance:disable

: Or, if you need to specify a higher memory allocation :

php -dallow_url_fopen=On -dmemory_limit=512M composer.phar update
php bin/magento maintenance:enable
php -dmemory_limit=256M bin/magento setup:upgrade
php -dmemory_limit=512M bin/magento setup:di:compile
php -dmemory_limit=128M bin/magento setup:db-schema:upgrade
php -dmemory_limit=256M bin/magento indexer:reindex && php -dmemory_limit=128M bin/magento cache:clean && php -dmemory_limit=128M bin/magento cache:flush && php -dmemory_limit=128M bin/magento cache:enable
php -dmemory_limit=128M bin/magento maintenance:disable


: Or, if you're in a cPanel type setup and need to force a PHP version :

php -dallow_url_fopen=On -dmemory_limit=512M -ea_php 71 composer.phar update
php bin/magento maintenance:enable
php -dmemory_limit=256M -ea_php 71 bin/magento setup:upgrade
php -dmemory_limit=512M -ea_php 71 bin/magento setup:di:compile
php -dmemory_limit=128M -ea_php 71 bin/magento setup:db-schema:upgrade
php -dmemory_limit=256M -ea_php 71 bin/magento indexer:reindex && php -dmemory_limit=128M -ea_php 71 bin/magento cache:clean && php -dmemory_limit=128M -ea_php 71 bin/magento cache:flush && php -dmemory_limit=128M -ea_php 71 bin/magento cache:enable
php -dmemory_limit=128M -ea_php 71 bin/magento maintenance:disable

Show the Demo Store Notice on Magento 2

If you're not yet live, or have a dev and live server, it's helpful to visually separate live vs dev with a demo store 'hello bar'.

  1. In admin, ContentDesignConfiguration
  2. Select the store to add the Demo notice to
  3. In 'Other Settings' -> 'HTML Head', set the 'Display Demo Store Notice'