This is an old revision of the document!
PhpStorm
https://www.jetbrains.com/phpstorm/download/other.html
wget https://download.jetbrains.com/webide/PhpStorm-2023.3.3.tar.gz tar -xvzf PhpStorm-2023.3.3.tar.gz sudo mv sudo mv PhpStorm-233* /opt/phpstorm /opt/phpstorm/bin/phpstorm
Add to menu and cinnamon panel launcher
cat > ~/.local/share/applications/phpstorm.desktop << EOD [Desktop Entry] Name=PhpStorm Exec=/opt/phpstorm/bin/phpstorm Comment= Terminal=false Icon=/opt/phpstorm/bin/phpstorm.png Type=Application EOD
https://www.jetbrains.com/resources/eap/
https://www.jetbrains.com/phpstorm/nextversion/
Download EAP tar.gz version, untar and move into /opt.
Useful settings:
- Settings > Languages & Frameworks > SQL Dialects and set it for the whole project.
- Enable Settings > Editor > Inspections > PHP > Undefined symbols > Undefined variable > Search for variable's definition outside the current file for project (alternative: variables defined in included/required files are marked as undefined. Solved by adding global $x to top of file.)
- set database per project folder or file in settings > Languages & Frameworks > SQL Resolution Scopes
- open project selection instead of reopening last project in File > Settings > System Settings > uncheck “Reopen projects on startup”
- Disable AI, Quodana and Space plugins
Deployment settings:
File → Settings → Build, Execution, Deployment → Deployment → +
SFTP
Enter server name
select ssh configuration for the server
set remote and local paths
- phpstorm_update.sh
#!/bin/bash URL=$(curl -s "https://data.services.jetbrains.com/products?code=PS&release.type=eap%2Crc&fields=distributions%2Clink%2Cname%2Creleases" | jq ".[0].releases[0].downloads.linux.link" | cut -d '"' -f 2) FILE=$(echo $URL | cut -d "/" -f 5) DIR=$(basename "$FILE" ".tar.gz") VER_LATEST=$(echo $DIR | cut -d "-" -f 2) if [ -f "/opt/PhpStorm/build.txt" ]; then VER_INST=$(cat /opt/PhpStorm/build.txt | cut -d "-" -f 2) else VER_INST=0 fi function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } echo "Available version $VER_LATEST and installed version $VER_INST" if [ $(version $VER_INST) -lt $(version $VER_LATEST) ]; then echo "Installing version $VER_LATEST..." wget $URL tar -xvzf $FILE sudo rm -rf /opt/PhpStorm-old sudo mv /opt/PhpStorm /opt/PhpStorm-old sudo mv $DIR /opt/PhpStorm else echo "Latest version $VER_LATEST already installed..." fi
- ~/.local/share/applications/phpstorm.desktop
[Desktop Entry] Name=PhpStorm Exec=/opt/PhpStorm/bin/phpstorm.sh Comment= Terminal=false Icon=/opt/PhpStorm/bin/phpstorm.png Type=Application
First run:
cd /opt/PhpStorm/bin/ ./phpstorm.sh
Probably useful settings to disable:
- Settings > Editor > Inspections > JavaScript > Probable Bugs > Equality operator may cause type coercion
- Settings > Editor > Inspections > PHP > Composer
- Settings > Editor > Inspections > Proofreading > Typo
- Settings > Languages & Framework > Javascript > “JavaScript language version” to “EcmaScript 5.1”
- Settings > Appearance & Behaviour > System Settings > Updates > “Check IDE updates for” to “Stable Releases”
- Settings > Editor > Inspections > PHP > Undefined symbols > “Undefined variable” set “Search for variable's definition outside the current file”
- Code style → php → wrapping and braces → braces placement → in function declaration: end of line
To remove error message “Failed to push to [apps-repo] remote: bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)” on failed mercurial pushes, generate the en_US.UTF-8 locale on the systems:
sudo sed -i 's/# en_US.UTF-8/en_US.UTF-8/g' /etc/locale.gen sudo locale-gen en_US.UTF-8
Error: Unable to save settings: Failed to save settings. Please restart PhpStorm.
Solution: Could you please check that the radio button Settings | PHP | Composer | Execution actually has a value specified? And if it doesn't, please choose one and then check how it goes.
Deployment
https://www.jetbrains.com/help/phpstorm/tutorial-deployment-in-product.html#config
Remote Tools and Custom Menu
Example custom main menu with remote tools and icons:
- ~/.config/PhpStorm2024.2/remoteTools/Remote Tools.xml
<toolSet name="Remote Tools"> <tool name="Show changeset of remote system" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="false" CONNECTION_TYPE="SSH_CONFIG" CONNECTION_ID="root@remotesystem:22 agent"> <exec> <option name="COMMAND" value="/root/hgchangeset.sh" /> <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="/var/www/htdocs/" /> </exec> </tool> <tool name="sync remote system to remote system" showInMainMenu="false" showInEditor="false" showInProject="false" showInSearchPopup="false" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true" CONNECTION_TYPE="SSH_CONFIG" CONNECTION_ID="root@remotesystem:22 agent"> <exec> <option name="COMMAND" value="/root/_rsyncwrapper.sh" /> <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="/root" /> </exec> </tool> </toolSet>
- ~/.config/PhpStorm2024.2/options/customization.xml
<application> <component name="com.intellij.ide.ui.customization.CustomActionsSchema"> <group value="Vcs.Operations.Popup" is_group="true" forse_popup="false" action_type="-1" position="23"> <path value="root" /> </group> <group value="Vcs.Log.Toolbar.RightCorner" is_group="true" forse_popup="false" action_type="-1" position="22"> <path value="root" /> </group> <group value="Vcs.Log.ChangesBrowser.Toolbar" is_group="true" forse_popup="false" action_type="-1" position="21"> <path value="root" /> </group> <group value="ChangesViewToolbar" is_group="true" forse_popup="false" action_type="-1" position="20"> <path value="root" /> </group> <group value="StringManipulation.Group.SwitchCase" is_group="true" forse_popup="false" action_type="-1" position="19"> <path value="root" /> </group> <group value="StringManipulation.Group.Main" is_group="true" forse_popup="false" action_type="-1" position="18"> <path value="root" /> </group> <group value="RunTab.TopToolbar" is_group="true" forse_popup="false" action_type="-1" position="17"> <path value="root" /> </group> <group value="RunTab.TopToolbar.More" is_group="true" forse_popup="false" action_type="-1" position="16"> <path value="root" /> </group> <group value="Markdown.Toolbar.Floating" is_group="true" forse_popup="false" action_type="-1" position="15"> <path value="root" /> </group> <group value="Console.TableResult.FloatingToolbarGroup" is_group="true" forse_popup="false" action_type="-1" position="14"> <path value="root" /> </group> <group value="Floating.CodeToolbar" is_group="true" forse_popup="false" action_type="-1" position="13"> <path value="root" /> </group> <group value="Vcs.FileHistory.Toolbar" is_group="true" forse_popup="false" action_type="-1" position="12"> <path value="root" /> </group> <group value="XDebugger.Watches.Tree.Toolbar" is_group="true" forse_popup="false" action_type="-1" position="11"> <path value="root" /> </group> <group value="XDebugger.ToolWindow.TopToolbar3" is_group="true" forse_popup="false" action_type="-1" position="10"> <path value="root" /> </group> <group value="XDebugger.ToolWindow.TopToolbar3.Extra" is_group="true" forse_popup="false" action_type="-1" position="9"> <path value="root" /> </group> <group value="NavBarToolBar" is_group="true" forse_popup="false" action_type="-1" position="8"> <path value="root" /> </group> <group value="NavbarPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="7"> <path value="root" /> </group> <group value="ScopeViewPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="6"> <path value="root" /> </group> <group value="ProjectViewPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="5"> <path value="root" /> </group> <group value="EditorTabPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="4"> <path value="root" /> </group> <group value="EditorGutterPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="3"> <path value="root" /> </group> <group value="EditorPopupMenu" is_group="true" forse_popup="false" action_type="-1" position="2"> <path value="root" /> </group> <group value="NewUiRunWidget" is_action="true" action_type="-1" position="2"> <path value="root" /> <path value="Main Toolbar" /> <path value="Right" /> </group> <group value="PhpListenDebugAction" is_action="true" action_type="-1" position="1"> <path value="root" /> <path value="Main Toolbar" /> <path value="Right" /> </group> <group value="MainMenu" is_group="true" forse_popup="false" action_type="-1" position="0"> <path value="root" /> </group> <group value="Vcs.UpdateProject" is_action="true" action_type="1" position="2"> <path value="root" /> <path value="Main Toolbar" /> <path value="Left" /> <path value="VCS Group" /> </group> <group value="Vcs.Push" is_action="true" action_type="1" position="3"> <path value="root" /> <path value="Main Toolbar" /> <path value="Left" /> <path value="VCS Group" /> </group> <group value="RemoteTool_Remote Tools_Show changeset of remote system" is_action="true" action_type="1" position="5"> <path value="root" /> <path value="Main Toolbar" /> <path value="Left" /> </group> <group value="RemoteTool_Remote Tools_sync remote system to remote system" is_action="true" action_type="1" position="6"> <path value="root" /> <path value="Main Toolbar" /> <path value="Left" /> </group> <action id="RemoteTool_Remote Tools_Show changeset of remote system" icon="/home/user/Desktop/changelog-white.png" /> <action id="RemoteTool_Remote Tools_sync remote system to remote system" icon="/home/user/Desktop/sync-white.png" /> </component> </application>