How to set up PhpStorm to use for developing Tiki


1. Why should I use PhpStorm?

1.1. General Info

Get PhpStorm from:

General info from:

Started during http://tiki.org/TikiFestBarcelona3 !

1.2. Top 10+ Reasons to Love PhpStorm

For TikiFestMontreal-Ottawa11, in no particular order (yet) by Jonny Bradley

  1. Navigate -> File... (and Class... and Symbol...)
    Especially the way you can type the initials of the words in the filename
    e.g. "t a t o o" gets you tiki-admin_toolbars (the php, tpl and js files if you want)
  2. Edit -> Copy Reference
    Except the way it includes the leading slash... must looks for a pref for that!
  3. Image
    makes me smile, but seriously, the debugger knows what's going on to a far deeper level than any other PHP IDE i've tried
  4. Code -> Refactor as... (variable, method etc)
    Common on Java IDE, but not seen it on PHP
  5. Code -> Comment/Un-comment
    Sounds trivial but it's the first thing i've found that does it correctly in all languages, not just PHP and JS, but Smarty, HTML and CSS too
  6. View -> Compare with clipboard (you can merge changes form the clip board into an open file)
  7. CSS colour indicators
  8. Column select
  9. Tools -> Deployments -> Sync and Diff with Deployment
  10. Code completion on SQL files (fills in tables and column names from your database - thanks Luci ;)
  11. Branch merging - as you would expect, far more civilised (and quick) than any other IDE i've tried, and so much more controllable (for me) than using a shell
  12. Shelve changes which reverts your current changes and keeps them in a safe(ish) place until you want them back again
  13. Live templates: create your own idiosyncratic code snippets and insert them by typing an abbreviated name followed by TAB
  14. You can get a free version for use on your Tiki work (see details below)

2. Setting it up

2.1. Getting a Free OpenSource license for your Tiki work

If you are a regular contributor to the TikiWiki project, then you may be eligible for a free license to PhpStorm.

Just contact Nelson (nkoth on IRC) and ask him for the user name and license key. Then:

  • Start PhpStorm
  • Help > Register
  • Enter the user name and license key exactly as in the email

 Don't enter the key as a single line!

The license key you will have received, may be on several lines.

You must enter it exactly like that, without trying to "unwrap" the key into a single line.

2.2. Configuring the Debugger

Choose some debugger like Xdebug:

sudo apt-get install php5-xdebug phpunit

Under Mac 10.9 Maverick using MacPorts (couldn't manage to install phpunit) Bernard Sfez / Tiki Specialist :

sudo port install php5-xdebug

or similar (Zend_debugger)

Settings to be pasted from Robert's config at the end of /etc/php5/apache2/php.ini

; Remote settings

; General

; Trace options

; Profiling

2.2.1. Remote Debugging

Some useful info on setting up xdebug and phpstorm to do remote debugging can be found here: https://confluence.jetbrains.com/display/PhpStorm/Remote+debugging+in+PhpStorm+via+SSH+tunnel, mainly the part about the ssh port 9000 tunnel - that's the bit that was missing for me Jonny Bradley

2.3. Configuring the PHP interpreter & path

PhpStorm expects to find the Php interpreter in a particular location (ex: on my mac, it's /usr/bin/php). But it could be that you are using an interpreter that is in a different location.

Here is how you can do that. The particulars of the steps seem to depend on the version of PhpStorm you use. Below are the steps as described originally by Jonny, and those for PhpStorm 6.0 (written by Alain)

# For PhpStorm 6.0

1. PHP Interpreter

  • Preferences > PHP
  • Click on ... to the right of Interpreter.
  • Browser to the location of the php interpreter (ex: /opt/local/bin)
  • Click on the + sign at the top left, then Specify other
  • For Name, enter a freetext name for that version of the interpreter (you could just set it to the full path)
  • For PHP home, enter the path of the directory that contains the php executable (ex: /opt/local/bin). Do not include php at the end of the path (it has to be a directory, not the path to the executable itself).
  • OK

2. Include path

  • Preferences > PHP
  • Choose the interpreter for which you want to set the path, by clicking on the ... to the right of Interpreter
  • Click on the + sign at the bottom right of the PHP window

# Original instructions by Jonny

File → Settings → PHP (open)

1. PHP Interpreter

Interpreter > Add

Enter the following:
Name: "php on ubuntu" (free text)
PHP home: /usr/bin/
Debugger: Xdebug

→ See appear the PHP version (here PHP version 5.3.... )

2. Include path

  • Click at the plus sign
  • add path to application source (real place without links)

2.4. Server

  • Server
    • Name: localhost
    • Host: localhost
    • Port: 80
    • Debugger: Xdebug
    • (X) Use path mappings (select if the server is remote or symlinks are used)


2.5. Add a PHP Web Application

Run > Debug > Edit configurations > Click at the plus sign in the left column > PHP Web Application: "Run/Debug Configurations"


2.6. Configure Subversion (SVN)

VCS > Some option to set the project as being under subversion (we do notsee the option any more once it is selected once).
Since then, you have all the options for managing the subversion checkout.
To update from trunk svn, do:
VCS > Subversion > Update files
IF requested, select the branch that you are working with (ues HEAD for trunk).

One thing to watch out for is that you need to disable certain options in the commit dialog:

PhpStorm Svn Commit Options

Basically, all the checkboxes in the Subversion and before commit section have to be unchecked.

To get to that box, you need to do a commit:

  • Make sure you have at least one outgoing change.
  • Click on the Changes tab at bottom of the screen.
  • Right click on one of the changes in the Default section.
  • Commit Changes
  • You should now see the dialog depicted in the above screenshot.

3. Troubleshooting and Tips for Newbies

"Could not save project" error

If you get this error, it probably means that the permissions on your Tiki files are wrong. Typicall, when you run setup.sh, all the files in Tiki end up being owned by _www with _www as the group (unless you specify other choices). But on most platforms (at least on Mac), PhpStorm runs as your own regular user, which is not part of group _www.

Here is how to fix this issue on Mac. Details for other platforms may vary.

# First, add your user name to group _www
sudo dseditgroup -o edit -a yourusername -t user _www

# Next, rerun setup.sh, but this time, specify
# yourusername as the user, but leave _www as
# the group
sudo sh setup.sh

# Then make sure certain directories are writeable
# by the _www group.
sudo chmod -R g+w db dump img/wiki img/wiki_up img/trackers modules/cache templates_c templates styles whelp

'Cannot find PHPUnit in include path' error

When attempting to run project '9.x' on 'LocalApache' server, I see these messages:

Cannot find PHPUnit in include path (.:/usr/share/php:/usr/share/pear) Unable to attach test reporter to test framework or test framework quit unexpectedly

Once phpunit is installed (& phpstorm restarted), the error message dissapears.

'Debug server doesn't exist' error

When attempting to go to "Run > Debug '9.x on LocalApache'", I see this message at the bottom:

Error running 9.x on LocalApache: Debug server doesn't exist. Check 'Remote' tab in run configuration editor.

Ok, after I added "localhost" as Debug Server, and run again "Run > Debug '9.x on LocalApache'", I did get these messages:

Testing started at 18:35 ... Executing tests Http request failed: HTTP/1.0 500 Internal Server ErrorE_WARNING: require_once(Zend/Cache/Backend/ExtendedInterface.php): failed to open stream: No such file or directory #0 /var/www/9.x/lib/core/Zend/Cache/Backend/Test.php(27): require_once() #1 /usr/share/php/PHPUnit/Util/Fileloader.php(95): include_once() #2 /usr/share/php/PHPUnit/Util/Fileloader.php(79): load() #3 /var/www/9.x/_intellij_phpunit_launcher.php(527): checkAndLoad() #4 /var/www/9.x/_intellij_phpunit_launcher.php(821): collectTestsFromFile() #5 /var/www/9.x/_intellij_phpunit_launcher.php(929): main() E_COMPILE_ERROR: require_once(): Failed opening required 'Zend/Cache/Backend/ExtendedInterface.php' (include_path='.:/usr/share/php:/usr/share/pear') #0 /var/www/9.x/lib/core/Zend/Cache/Backend/Test.php(27)

Can't commit a change

Sometimes, nothing happens when you click on the Commit button.

When that happens, make sure you uncheckall the boxes in the Subversion and before commit section have to be unchecked.

PhpStorm Svn Commit Options

'Connection with 'xdebug' was not established' error

You typically get this error when running the debugger PHP Script run configuration.

The error usually means that the PHP interpreter you are using does not have the xdebug extension installed.

To find out which interpreter you are using

  • Preferences > PHP
  • Click on ... to the right of the Interpreter field
  • The path of the interpreter is in the PHP Home field.

To see if xdebug is installed for that interpreter:

pathtoyourinterpreter/php -i | grep xdebug

If the phpinfo doesn't contain any line with xdebug, it means it's not installed.

To install xdebug for use with PhpStorm, see the Configuring the Debugger section above.

PhpStorm becomes sluggish

If you notice that PhpStorm occasionally gets in a rut and becomes very slow in responding to your actions, it probably means that you haven't allocated enough heap memory to it.

The way to fix it is to add the heap size in file idea.vmoptions. On the mac, this file is located under ~/Library/Preferences/WebIde60/.

For example, here is Alain's idea.vmoptions file:


Can't use svn from command line

Althogh the graphical svn UI in PhpStorm is pretty good, there may be time when you want to use the command line SVN.

If you do that, it could be that the command line SVN will complain that the current directory is in the wrong SVN format.

This is usually due to the fact that PhpStorm uses its own version of SVN (which is embedded as a java library), and that it uses a SVN data format that is more recent that the command line SVN you are using. For example, maybe your command line SVN uses the 1.6 format, while the PhpStorm svn uses 1.7.

There are two ways to deal with this

  • Upgrade your command line SVN so it can deal with the data format version used by PhpStorm.
  • Redo the checkout, but ask PhpStorm to store the data in the format that your command line uses.

As of this writing (Oct 29, 2013), the easiest option for Mac users seems to be to redo the checkout, because macport doesn't seem to have version 1.7 of the command line SVN (which is what PhpStorm uses by default).

4. Useful tips

Turn on Autoscroll from source option, so that the project browser repositions itself automatically to the page you are currently have in the editors. That way, if you want to do an operation on the file you are editing (ex: delete, rename), or see other files in the viscinity, you can just go from the editor to the project browser.

To set this option on:

  • Click on the project
  • Click on the gear icon (top right of the project browser)
  • Check Autoscroll from source

Make use of the various navigation and search shortcuts. One really powerful thing about those is that you can search for things by specifying parts of its name, that might not be consecutve. So for example, searching for a file with "tiki permissions" will find "tiki-debug-permissions.tpl".

Below are some of the more useful search and navigation shortcuts:

  • Command+Shift+O: search for a file.
  • Ctrl+Shift+F: Search all files in the project
  • Command+O: Search for a class.
  • Ctrl+Command+O: Search for a symbol (class, method, variable, etc...)

4.2. How to merge

Useful tip provided by jonnyb in the devel list (27/02/15)

Seems that the way i do merging of single commits in phpStorm isn't in their documentation, i think i just worked it out several versions ago (don't like manuals mostly So here's what i do... let's say i want to merge a commit from trunk into 14.x... First thing to do is configure the branches in your project (you need that also to do "Compare with branch..." which is really handy too. https://www.jetbrains.com/phpstorm/help/configure-subversion-branches.html It should work out where trunk is, and last time i did it it added branches, mods, third_party etc as branch locations, you can remove everything apart from branches from there (the lower box). To do a merge, go back to the Changes panel - Working Copy info pane where the config branches link was and just under it is "Merge from..." - click that and the little drop down branch menu appears, click "trunk" (in this case) and you get the "Select Merge Variant" dialog, with "Quick Manual Select" button, should be obvious from there (?) The other two options (merge all, only any use when merging an experimental branch back into trunk, but i've never used it, looked too scary!) and Select with pre-filter, which takes ages and ages on tiki, probably due to our extensive history (and svn being a bit rubbish at this). Hope that helps, odd that it's not on their documentation (afaics) jonny P.S. Compare with branch instructions are here https://www.jetbrains.com/phpstorm/help/comparing-with-branch.html

5. Useful links

Free video tutorial to help you setting (xdebug) and customising PhpStorm: https://laracasts.com/series/how-to-be-awesome-in-phpstorm/


The following is a list of keywords that should serve as hubs for navigation within the Tiki development and should correspond to documentation keywords.

Each feature in Tiki has a wiki page which regroups all the bugs, requests for enhancements, etc. It is somewhat a form of wiki-based project management. You can also express your interest in a feature by adding it to your profile. You can also try out the Dynamic filter.

Accessibility (WAI & 508)
Accounting 7.x
Ajax 2.x
Articles & Submissions
Batch 6.x
BigBlueButton audio/video/chat/screensharing (5.x)
Browser Compatibility
Communication Center
Contacts Address book
Contact us
Content template
Contribution 2.x
Credits 6.x
Custom Home (and Group Home Page)
Database MySQL - MyISAM
Database MySQL - InnoDB
Date and Time
Debugger Console
Directory (of hyperlinks)
Documentation link from Tiki to doc.tiki.org (Help System)
Docs 8.x
Draw 7.x
Dynamic Content
Dynamic Variable
External Authentication
Featured links
Feeds (RSS)
File Gallery
Friendship Network (Community)
i18n (Multilingual, l10n, Babelfish)
Image Gallery
Inter-User Messages
Kaltura video management
Live Support
Logs (system & action)
Lost edit protection
Meta Tag
Missing features
Visual Mapping 3.x
Mobile Tiki and Voice Tiki
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Organic Groups (Self-managed Teams)
Payment 5.x
Performance Speed / Load / Compression / Cache
Revision Approval
Search engine optimization (SEO)
Semantic links 3.x
Shopping Cart 5.x
Site Identity
Smarty Template
Social Networking
Spam protection (Anti-bot CATPCHA)
Staging and Approval
Syntax Highlighter (Codemirror)
Tags 2.x
Tell a Friend, alert + Social Bookmarking
Terms and Conditions
TikiTests 2.x
Token Access
Toolbar (Quicktags)
User Administration
User Files
User Menu
Webmail and Groupmail
WebServices 3.x
Wiki 3D
Wiki History, page rename, etc
Wiki plugins extends basic syntax
Wiki syntax text area, parser, etc
Wiki structure (book and table of content)
Workspace and perspectives 4.x

Useful Tools