====== 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/
https://godmodeuser.com/p/25
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
#!/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
[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, store in ''~/.local/share/icons/'' :
{{php:changelog-white.png?50}} {{php:sync-white.png?50}}\\
{{php:sync-black.png?50}}{{php:changelog-black.png?50}}