How to use local PHPStorm to work on an instance.
The default code editor for MDOQ development is web based VSCode, which is configured and setup to work as soon as your instance is ready. However if you wish to work with your local version of VSCode, there are a couple of extra steps to connect your machine to VSCode.
Once your instance is ready follow the steps below.
Configuring PHPStorm
- Enable SFTP for your instance.
- In PHPStorm, open the Settings/Preferences (depending on your host OS).
Select Tools > SSH Configurations - Click “+”.
- Note the host and port have to be entered in individual fields.
Enter the host and port and user name. Leave “Local port” at the default value “Dynamic”.
Choose the Authentication type “Password”.
Enter the password.
Click “Test Connection”.
When asked, allow the connection to a new unknown host.
Now that the SSH configuration is complete, click “Apply”. - In the settings/preferences, and select
Build, Execution, Deployment > Deployment - Click “+” and select “SFTP”.Enter a name for the configuration, for example “Training”.
Ensure the checkbox “Visible only for this project” is checked.
Choose the type “SFTP”.
Select the SSH Configuration created in step 4 above.
Enter the root path “/home/mdoq”.
Enter the Web server URL from step 6 during the preparation. - Select the tab “Mappings”.
Enter the path to your local project directory to the field “Local path” (probably this is set automatically).
Enter “/htdocs” in the field “Deployment path”
Enter “/” in the field Web path (probably this is set automatically). - Select the tab “Excluded Paths”.
Add three excluded deployment paths (by clicking “+” at the bottom of the field):/htdocs/var
/htdocs/pub/static
/htdocs/pub/media - Now that the deployment configuration is complete, click “OK” to close the Settings / Preferences.
- In the top menu, select Tools > Deployment > Automatic Upload.
(Remember to also enable and configure the PHPStorm Magento Plugin if it is installed).
PHPStorm terminal integration
You can use the built-in PHPStorm terminal to connect to the server and run bin/magento commands directly from within PHPStorm. You will need the host and port from Downloading files with SCP (optional):
- In PHPStorm, open the Settings/Preferences (depending on your host OS).
- Select Tools > SSH Configurations
- Click “+”
- Enter the host and port
- Under "Authentication Type", select OpenSSH config and authentication agent
- Click "Apply"
When done, select Tools > SSH Terminal and select the configuration you just created.
Finally, select Tools => Start SSH Session and you should see the terminal open on the MDOQ server.