Difference between revisions of "Installing Magento 2 Extensions : Plesk"
Jump to navigation
Jump to search
(Created page with "==Aims & Preparation== Make sure you've gone through the Pre-install Checklist before starting! {{idea|Upgrading f...") |
m |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{#description2:Check our easy guide to installing Magento 2 extensions in Plesk control panel based servers.}} | ||
==Aims & Preparation== | ==Aims & Preparation== | ||
Make sure you've gone through the [[Installing_Magento_2_Extensions_:_Pre-install_Checklist|Pre-install Checklist]] before starting! | Make sure you've gone through the [[Installing_Magento_2_Extensions_:_Pre-install_Checklist|Pre-install Checklist]] before starting! | ||
Line 14: | Line 15: | ||
==Installation== | ==Installation== | ||
+ | ===Plesk Pre-check=== | ||
+ | # Check you're running a version of PHP that's [http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html compatible with Magento]. | ||
+ | # Check you're setup with the same PHP version on the commandline as the frontend. | ||
+ | # Remove pre-made cache files: | ||
+ | : <code>rm -rf generated/ var/view_preprocessed/ var/composer_home/cache/ var/cache/ var/page_cache/</code> | ||
+ | # Check the correct user to log in as on the commandline | ||
+ | ## It's *not* root | ||
+ | ##: ''If you run these commands as root, you'll find these folder generated with root permissions:'' | ||
+ | ##: {{folder|generated/}} | ||
+ | ##: {{folder|var/view_preprocessed/}} | ||
+ | ##: {{folder|var/composer_home/cache/}} | ||
+ | ##: {{folder|var/cache/}} | ||
+ | ##: {{folder|var/page_cache/}} | ||
+ | ## Find the correct user here: | ||
+ | ##:[[File:plesk-commandline-user-magento-2.png|link=|600px]] | ||
+ | # If you get an error during install along the lines of: | ||
+ | #: <code>PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/vhosts/{domain}/httpdocs/var/page_cache" is not writable</code> | ||
+ | #: then check if it's fixed by running CLI commands as the correct user, eg: | ||
+ | #: <code>sudo -u {username here} bin/magento setup:upgrade</code> | ||
+ | # If you get a PHP warning like: | ||
+ | #:''Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html'' | ||
+ | ## Remove folders with incorrect permissions: | ||
+ | #: <code>sudo -u {username here} rm -rf generated/ var/view_preprocessed/ var/composer_home/cache/ var/cache/ var/page_cache/</code> | ||
+ | ## Run commands with both correct specific user *and* php version, eg. | ||
+ | ##: <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:di:compile</code> | ||
+ | ##: <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:static-content:deploy -f</code> | ||
+ | ##: <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento cache:flush</code> | ||
+ | |||
===1. Upload The Files=== | ===1. Upload The Files=== | ||
:# Unzip your downloaded zip and open the single folder (usually the extension name). | :# Unzip your downloaded zip and open the single folder (usually the extension name). | ||
Line 45: | Line 74: | ||
:<code>composer update</code> | :<code>composer update</code> | ||
− | ::''• | + | ::''• Depending on how you have Plesk setup, you might find it easier to run a local version of composer, instead of server-wide one:'' |
::''Install:'' | ::''Install:'' | ||
Line 84: | Line 113: | ||
:* re-compile: | :* re-compile: | ||
:<code>php bin/magento setup:di:compile</code> | :<code>php bin/magento setup:di:compile</code> | ||
+ | : *You may need to force correct user and php version, eg: | ||
+ | <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:di:compile</code> | ||
+ | |||
+ | :* generate static content: | ||
+ | :<code>php bin/magento setup:static-content:deploy -f</code> | ||
+ | : *You may need to force correct user and php version, eg: | ||
+ | <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:static-content:deploy -f</code> | ||
:::''^ Check that the code works all the way through to 100% (usually 7 lines)'' | :::''^ Check that the code works all the way through to 100% (usually 7 lines)'' | ||
Line 103: | Line 139: | ||
:<code>php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code> | :<code>php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable</code> | ||
+ | : *You may need to force correct user and php version, eg: | ||
+ | <code>sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento cache:flush</code> | ||
===6. Check Installation=== | ===6. Check Installation=== |
Latest revision as of 13:23, 28 September 2020
Contents
- 1 Aims & Preparation
- 2 Installation
- 2.1 Plesk Pre-check
- 2.2 1. Upload The Files
- 2.3 2. Enable Maintenance Mode
- 2.4 3. Disable the Cache
- 2.5 4. Run Install & Setup Scripts
- 2.6 5. Refresh index & cache
- 2.7 6. Check Installation
- 2.8 7. Set User Permissions
- 2.9 8. Clear static content
- 2.10 9. Enter The License Key
- 2.11 10. Save The Config Page
- 2.12 11. Disable Maintenance Mode
- 3 Uninstalling
- 4 Registering the License
- 5 Final Check
Aims & Preparation
Make sure you've gone through the Pre-install Checklist before starting!
Upgrading from an older version? Check our Upgrading Magento 2 Extensions Guide
The main aim of this guide is to provide some help if you're installing Magento 2 on a Plesk system.
Installation
Plesk Pre-check
- Check you're running a version of PHP that's compatible with Magento.
- Check you're setup with the same PHP version on the commandline as the frontend.
- Remove pre-made cache files:
rm -rf generated/ var/view_preprocessed/ var/composer_home/cache/ var/cache/ var/page_cache/
- Check the correct user to log in as on the commandline
- It's *not* root
- If you run these commands as root, you'll find these folder generated with root permissions:
- generated/
- var/view_preprocessed/
- var/composer_home/cache/
- var/cache/
- var/page_cache/
- Find the correct user here:
- It's *not* root
- If you get an error during install along the lines of:
PHP Fatal error: Uncaught Zend_Cache_Exception: cache_dir "/var/www/vhosts/{domain}/httpdocs/var/page_cache" is not writable
- then check if it's fixed by running CLI commands as the correct user, eg:
sudo -u {username here} bin/magento setup:upgrade
- If you get a PHP warning like:
- Magento supports 7.0.2, 7.0.4, and 7.0.6 or later. Please read http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements.html
- Remove folders with incorrect permissions:
sudo -u {username here} rm -rf generated/ var/view_preprocessed/ var/composer_home/cache/ var/cache/ var/page_cache/
- Run commands with both correct specific user *and* php version, eg.
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:di:compile
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:static-content:deploy -f
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento cache:flush
1. Upload The Files
- Unzip your downloaded zip and open the single folder (usually the extension name).
- Inside that you'll see app and m2.0.patches. Open this containing folder inside your FTP app.
- Locate your website's Magento app folder in the same FTP app. You should now have the unzipped app on one side, and your main website folder (containing the Magento app folder) on the other side.
- * Check that you see an app folder each side.
- Drag the app folder from inside the unzipped folder into your remote site (the important thing here is not to drag on top of another folder, or the files will be placed in the wrong location - easiest is to drag onto a file or blank space on the remote side).
- You may be asked Merge or Replace? by your FTP app. Choose Merge for folders and Replace for files.
- Only if you're using a version of Magento 2 that's older than 2.1, copy m2.0.patches into your remote root folder, overwriting any file changes.
2. Enable Maintenance Mode
- This will display your store 'Down for Maintenance' page in the frontend
php bin/magento maintenance:enable
- * Not needed on local test site!
3. Disable the Cache
- Disable the cache in SystemCache Management
- Or, if you're in the commandline already:
php bin/magento cache:disable
4. Run Install & Setup Scripts
- Run these on the command line, from inside the magento root:
Update composer
- In the magento root folder run:
composer update
- • Depending on how you have Plesk setup, you might find it easier to run a local version of composer, instead of server-wide one:
- Install:
curl -sS https://getcomposer.org/installer | php
- Run:
php composer.phar update
- Run:
- Check that the 'composer update' process completes before continuing - if it says 'Killed' then it hasn't completed
- ^ If you see this, stop and get composer updating before you continue
Install the core Moogento files
- If this is your first Moogento M2 plugin, then run these first:
php bin/magento module:enable Moogento_License
php bin/magento module:enable Moogento_Core
Install the module
- Run the appropriate one for the plugin you want to install.
php bin/magento module:enable Moogento_PickPack
php bin/magento module:enable Moogento_Shipeasy
php bin/magento module:enable Moogento_Stockeasy
php bin/magento module:enable Moogento_Profiteasy
Setup scripts
php bin/magento setup:upgrade
- If you get an error here, it might be helpful to see details about why it failed. In that case try:
bin/magento setup:upgrade -vvv
- re-compile:
php bin/magento setup:di:compile
- *You may need to force correct user and php version, eg:
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:di:compile
- generate static content:
php bin/magento setup:static-content:deploy -f
- *You may need to force correct user and php version, eg:
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento setup:static-content:deploy -f
- ^ Check that the code works all the way through to 100% (usually 7 lines)
- If it doesn't, you should fix this first before proceeding.
- Here's roughly how it should look when successful:
- then we're going to upgrade the database, with any new tables needed by the plugin:
php bin/magento setup:db-schema:upgrade
5. Refresh index & cache
- re-index
php bin/magento indexer:reindex
- refresh caches
php bin/magento cache:clean && php bin/magento cache:flush && php bin/magento cache:enable
- *You may need to force correct user and php version, eg:
sudo -u {username here} /opt/plesk/php/7.1/bin/php bin/magento cache:flush
6. Check Installation
- Head to StoresConfigurationAdvanced -> Advanced and you should see your new module in the admin panel.
7. Set User Permissions
- Log out then Log in.
- Head to SystemPermissionsUser Roles
- Check that you have assigned the new Moogento Extension options to the appropriate roles, and save.
- If saving an admin role, likely you have 'All' resources set; just re-save this:
-
- If saving a partial access role (eg. granting pickers access to create Packing Sheets), find the new extension sections and grant as needed (eg. here is access to edit the PDF templates):
- Head to SystemPermissionsUsers
- Check that you have assigned the correct role (that we just granted the appropriate Extension options to) to the appropriate users, and save.
8. Clear static content
- If you get some 404 errors, try clearing the static folder.
- Copy /static/.htaccess out of that folder
- Delete /static
- Put back .htaccess from (1)
- Or in commandline in root folder:
mv pub/static/.htaccess pub/.htaccess
rm -R pub/static
php bin/magento setup:static-content:deploy
mkdir pub/static
mv pub/.htaccess pub/static/.htaccess
- Run
bin/magento setup:static-content:deploy
9. Enter The License Key
- If you're installing a Moogento extension, we'll have sent you a license key. Let's install it!
- Navigate to MoogentoLicense.
- At the top, if this extension requires a license key, enter your license key (this will have been emailed to you; you can also find it inside your Moogento account downloads section).
- Enter the key and save the page. You should see a green tick!
10. Save The Config Page
- After entering the license key, clear the cache and logout again.
- Even if you're installing an extension without a license key, it's still a good idea to save the config section at this point (even if you've not made any changes).
11. Disable Maintenance Mode
php bin/magento maintenance:disable
Uninstalling
- Want to uninstall the plugins to check something?
- Here's a quick commandline 'stack', which you should be able to copy/paste, to disable all Moogento modules:
php bin/magento maintenance:enable
php bin/magento module:disable Moogento_PickPack
php bin/magento module:disable Moogento_Shipeasy
php bin/magento module:disable Moogento_Stockeasy
php bin/magento module:disable Moogento_Profiteasy
php bin/magento module:disable Moogento_Core
php bin/magento module:disable Moogento_License
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
- And the same to enable them again:
php bin/magento maintenance:enable
php bin/magento module:enable Moogento_License
php bin/magento module:enable Moogento_Core
php bin/magento module:enable Moogento_PickPack
php bin/magento module:enable Moogento_Shipeasy
php bin/magento module:enable Moogento_Stockeasy
php bin/magento module:enable Moogento_Profiteasy
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
Registering the License
Setup the Key for Dev/Staging Sites
- If you're setting up on a dev or staging server, we've got you covered. You can assign up to 2 dev/staging servers to each key, and we have a super-simple way to assign them.
- Navigate to your Moogento Account downloads section.
- Find the specific extension you want to request dev/staging access for.
- Click '+ dev domain'
- Enter the domain name.
- Click 'Request'
- Done! We'll check that and assign it within 1 working day.
- If your dev site is not an obvious dev subdomain (dev. / stage. / etc.) please ensure that the site is showing the Magento 'demo site' message.
- Enter the license key in every install you make with our software, including dev & staging sites.
- Before installing the software, please add the domain you'll be using to the list of authorised domains, as described above.
- It's against the terms of your license to use the software:
- - without entering the license key in every install
- - without authorising the domain before use
- (only needed if you're using multiple domains for testing - the first-used domain is registered automatically)
- - without authorising the domain before use
- - on multiple Magento installations
- (excepted : dev/staging sites for the specific domain the key is purchased for)
- - on multiple Magento installations
Final Check
- Check that it works at a basic level; this is also a good time to check your public store front. I would also make a test order at this stage, check that the emails you're expecting are coming through etc.
- If everything is ok and you have previously disabled compilation, now you can enable it.
- You should now be setup at a basic level.
- If you have any issues, check the Troubleshooting guide.