User Tools

Site Tools


php:phpstorm

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.sh 

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:

  1. Settings > Languages & Frameworks > SQL Dialects and set it for the whole project.
  2. 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.)
  3. set database per project folder or file in settings > Languages & Frameworks > SQL Resolution Scopes
  4. open project selection instead of reopening last project in File > Settings > System Settings > uncheck “Reopen projects on startup”
  5. 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 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

php/phpstorm.1724863737.txt.gz · Last modified: 2024/08/28 17:48 by Wulf Rajek