php check if date string has time | php search auto suggest | change the value of $_cookie


How To Setup And Configure PhpStorm on Ubuntu

A workflow to write code and manage web projects with Git and Github using PhpStorm

How To Setup And Configure PhpStorm on Ubuntu

Image source: Pixabay free images

PhpStorm is my favorite PHP IDE. It is a commercial Java application from Jetbrains. It combines performance with a great interface and an excellent Git integration. Very good documentation and support.

I have tried many other great IDE (Integrated Development Environment) for web development from time to time. HTML, CSS and JavaScript as front-end and mainly PHP for back-end (secondarily Perl, Python). I also want to write Bash scripts with the same tool.

Some of them are:

I don't use IDEs which provides "visual" tools. I prefer to write code.

I use Git as VCS (version control system). My code is hosted on Github (and Bitbucket).

I use Github Issues to track tasks and bugs.

What do you need from an IDE?

First things first: the perfect IDE, simply, does NOT exist.

These are some important features (imho) for a good IDE for web development:

  1. Code assistance

    What I mean with this is:

    • Syntax highlight
    • Code completion
    • Error checking
    • Code formatting (beautifier)

    It is very important the above tools to be functional in code with more than one "languages" (eg php, html, css, javascript). The more qualitative is the code you write, the more separated will be the backend from the frontend. Here they come to help the various frameworks. However, it is not always easy to avoid the coexistence of more than one programming "language". This is the rule in web development.

  2. VCS integration (Git in my case)

  3. Integration with Issue Trackers (Github Issues in my case)

  4. Performance

    Performance is critical for everyday work. However, the more features an IDE offers, the more reduced performance will appear. It is logical and expected.

  5. Easy code navigation

  6. Advance Search and Replace in file(s)

  7. Tab support

  8. Easily manage source files (encoding, line separators, tab size, handle large files etc)

  9. Project manager

Useful but not critical features:

  1. Integration with databases

    For me, Adminer for MySQL and PgAdmin for Postgresql are enough.

  2. Debugging

    The use of a debugger is more crucial for classic software development (C++, Java etc) than for web development.

    For frontend debugging Chrome DevTools is enough for me. For other browsers I use Browserstack.

    For backend (PHP) debugging I use these settings in development server:

            ini_set('display_errors', 'On');

    In most cases simple echo or var_dump statements are enough.

    Only in complex situations I use Xdebug.

  3. Testing
  4. Support code documentation tools
  5. Support various frameworks


Current version (at the time of writing this article) is PhpStorm 2016.3

The installation took place on Ubuntu 16.04 LTS. However, as PhpStorm is a Java application, the whole process is similar for every Linux distribution.

Download PhpStorm

Download Linux version here.

Then unpack the .tar.gz file in any folder. I use ~/Apps folder. So, the command:

tar xvzf PhpStorm-2016.3.2.tar.gz

will create the folder:


Only the first time, open a Terminal, go to bin directory in the installation folder:

cd ~/Apps/PhpStorm-163.10504.2/bin

and run the launch script:


Import settings

Starting a version of PhpStorm for the first time you will see this dialog:

(click the thumb for full image)

In my case I selected the first option, as I upgraded from 2016.2 to 2016.3 version.

This will create the settings folder in your home directory ~/.PhpStorm2016.3.

(click the thumb for full image)

Create a Desktop entry and add it to Ubuntu Unity Launcher

Use the PhpStorm tool:

Menu → Tools → Create a Desktop entry

(click the thumb for full image)

Now you can launch PhpStorm using Ubuntu Unity Dash (see image). Open Dash (click the top button of the Launcher or press SUPER key) and type some letters (eg "phpstorm"):

(click the thumb for full image)

Drag the icon to Ubuntu Unity Launcher to add it here.

Actually, this action creates the file /usr/share/applications/jetbrains-phpstorm.desktop. You can create it by yourself, if you prefer:

sudo nano /usr/share/applications/jetbrains-phpstorm.desktop

In my case:

[Desktop Entry]
Exec="/home/pontikis/Apps/PhpStorm-163.10504.2/bin/" %f
Comment=The Drive to Develop

REMARK: Replace /home/pontikis/Apps/PhpStorm-163.10504.2/ with your path (where you unpacked PhpStorm).

Manage License

You may use the trial version or register the program using:

Menu → Help → Register

(click the thumb for full image)

The first option (using your Jetbrains account) is the most convenient.

Configuration - Java settings

Which JDK to use?

By default the bundled JRE (based on OpenJDK 8) is used. This is the recommended JDK. To view the actual JDK version, use:

Menu → Help → About

(click the thumb for full image)

Read the PhpStorm launch shell script (/installation_path/bin/ ) to understand the order with which PhpStorm will search for Java in your system:

# ---------------------------------------------------------------------
# Locate a JDK installation directory which will be used to run the IDE.
# Try (in order): PHPSTORM_JDK, phpstorm.jdk, ../jre, JDK_HOME, JAVA_HOME, "java" in PATH.
# ---------------------------------------------------------------------

So, if you want to use another JDK, an easy way is to create the file phpstorm.jdk inside config folder:

nano ~/.PhpStorm2016.3/config/phpstorm.jdk

and add the relevant path, for example


Then, restart PhpStorm.

REMARK: I use Ubuntu Mono font, which does not appear normally with Oracle JDK. It works fine with default (bundled) JRE.

Memory settings

These settings included in file ~/.PhpStorm2016.3/phpstorm64.vmoptions in your home folder (concerning 64bit version).

This is the default file:


You may use the PhpStorm Diagnostic tool:

Menu → Help → Diagnostic → Change memory settings

(click the thumb for full image)

or you may edit this file manually:

nano ~/.PhpStorm2016.3/phpstorm64.vmoptions

I made the following changes in my workstation (16 GB RAM)


REMARK from Java documentation:

-Xms<size>        set initial Java heap size
-Xmx<size>        set maximum Java heap size

Configuration - PhpStorm settings

You can access PhpStorm Settings from:

Menu → File → Settings

After finishing your changes, do not forget to export them to Settings Repository or to a file (see below "Import - Export PhpStorm settings").


First, create your Layout, using the available windows. I prefer to view "Project" and "Remote Server" on the left side of main "Editor" window and "VCS/Local changes" and "Favorites" on the right side. Something like this:

(click the thumb for full image)

Store the layout you like as default:

Menu → Window → Store Current Layout as Default


PhpStorm is fully customizable (theme, fonts, code style per language etc). Manage the most important settings here:

Menu → File → Settings → Appearance & Behavior → Appearance

Menu → File → Settings → Editor

Quick Switch Scheme

You can quickly change Appearance (without go to "Settings") using:

Menu → View → Quick Switch Scheme

(click the thumb for full image)

Remote Servers

If you need to work with Remote Servers, define them at:

Menu → Tools → Deployment → Configuration


Browse the installed plugins or install new using:

Menu → File → Settings → Plugins

Manage passwords

Open "Settings" and go to:

Menu → File → Settings → Appearance & Behavior → System Settings → Passwords

Here you can define your password storage policy.

I use KeePassX to manage passwords in my system, so I avoid to permit other applications (web browser, PhpStorm or whatever) to store passwords. So, I chose the third option.

(click the thumb for full image)

However, if you use a lot of Remote Git Repositories, Remote Servers etc it is a good idea to use the first of second option.

Import - Export PhpStorm settings

There are a lot of settings you change in order to customize the IDE you are using. So, it's very important to have a tool to export these settings and apply them again when you reinstall the IDE in another computer.

You have two options:

  1. Settings repository (recommended)

    Create a (private) Github repository (eg "phpstorm"). You may use Bitbucket if you prefer.

    Get a Github Access Token, which is a secure way to access the GitHub API, without provide your password over the network. For example:

    (click the thumb for full image)

    More info here: Github - Creating an access token for command-line use.

    Then use the following tool to save current settings to Github repo you created or to apply settings from this repo to your working environment, or to merge them:

    Menu → File → Settings Repository

    (click the thumb for full image)

    You will be prompted to provide your token

    (click the thumb for full image)

    REMARK: I disabled the "Auto Sync" option at:

    Menu → File → Settings → Tools → Settings Repositpory

  2. Export - Import using file (settings.jar)


    Menu → File → Export settings

    (click the thumb for full image)

    and then

    Menu → File → Import settings

    to import them.

Basic workflow


Create New Project

From the Menu, select

Menu → File → New Project

Then follow the wizard.

I prefer the option

Menu → File → New Project from Existing files

because first I clone a project from Github using command line.

(click the thumb for full image)

Manage Projects

Recently PhpStorm provides a basic Project manager (list, group projects etc):

Menu → File → Open Recent → Manage Projects

(click the thumb for full image)

The same functionality ("Create New Project" and "Manage Projects") is available from "Welcome screen":

(click the thumb for full image)

Using Git with PhpStorm

PhpStorm has an excellent Git integration. Actually, every Git functionality you may need is available through graphical tools.

Menu → VCS → Git

However, I use PhpStorm Git tools only for

  • commit

    (click the thumb for full image)
  • show diff

    (click the thumb for full image)
  • revert
  • view log

For everything else (clone, checkout, branch, push, tag, fetch, merge etc I use command line (I have created simple custom shell scripts for this purpose).

Remote servers

Although PhpStorm is an excellent environment to work with Remote Servers, I follow my own custom model.

Development server

I don't have web server or database servers installed in my workstation. This software is installed in my development server, which is hosted in Hetzner.

My workflow in brief

  1. The code of all my projects is hosted in Github (and Bitbucket)
  2. Starting a project, I clone it from Github locally in my workstation. Then I create a PhpStorm project ("New Project from Existing files")
  3. In every project I create one or more dev branches. It depends on how complicated the project is and how many people are working together. In simple projects one dev branch is enough.
  4. When I make a change in the code, I commit it in a dev branch using PhpStorm. Then I use a small custom shell script to push to dev branch on Github and pull to the same dev branch on Development machine. In this way I am able to view/test the results in the browser.
  5. When I have completed a task I use a small custom shell script which performs a merge to master branch and then push. The same script updates also Bitbucket repos (a kind of backup for me).

Using Remote Servers in the "classical way" PhpStorm downloads the remote project locally. When you save a local file it is uploaded (automatically by default) in the Remote machine. This can be a little faster comparing with what I do in step 4 (see above), but there is no Git repo locally. Additionally, project downloading for big projects is much slower than cloning it.

Anyway, it is a matter of preference for each developer.

Production servers

I do not use PhpStorm (or any other IDE I used in the past) for deployment on production servers. Most of them use Debian. I use Git from command line or custom shell scripts. Actually, after testing, I pull the master branch to Production machine.

Using Github Issues with PhpStorm

PhpStorm offers a great integration with the most popular Issue Trackers.

You can manage Github Issues directly from PhpStorm.

First, register Github Issues using your Github Token

Menu → File → Settings → Tools → Tasks → Servers

(click the thumb for full image)

Open a task from Github Issues

(click the thumb for full image)

Open the task in PhpStorm

(click the thumb for full image)

This will create a new Changelist

(click the thumb for full image)

You can close an issue, either from commit message (recommended) or from PhpStorm.

Useful to remember

These are some useful tips for everyday use:

  1. CTRL+ALT+L is a shortcut to "Menu → Code → Reformat Code"

    As CTRL+ALT+L is reserved in Ubuntu ("Lock Screen"), I change this shortcut to CTRL+ALT+K

    To customize Keymap. use "Menu → File → Settings → Keymap"

    (click the thumb for full image)
  2. CTRL+SHIFT+A is a shortcut to "Menu → Help → Find action" (it reminds the very popular feature Command Palette of Sublime Text).

    For example, if you don't remember how to reformat code, press CTRL+SHIFT+A and type something relevant:

    (click the thumb for full image)
  3. Use CTRL+SPACE to force code completion (from the available options)
  4. Hold down CTRL over a variable (or function) to get valuable info about it
  5. CTRL+CLICK over a variable (or function) will move you where it’s defined

Get Support

To get Official Support, use:

Menu → Code → Submit Feedback

You will be moved to

Log in using your Jetbrains account and post your feedback.

Related Posts

You may also be interested in

Sign-up for our free email newsletter. Get updates when new tutorials and tips are published. You can unsubscribe anytime with a click.

Your comments are welcomed!

This site actively encourages commenting on any post. Comments are not pre-moderated, but this community does not tolerate direct or indirect attacks, name-calling or insults. Please, read terms of use and Comment Policy at privacy policy.

How To Setup And Configure Google Chrome on Ubuntu 16.04 How To Setup A Workstation Computer With Ubuntu 16.04 Desktop Step by Step