Deactivate VCS (Version Control System) in PHPStorm

You can enable VCS (Version Control System) in PHPStorm from the VCS menu but, how do you deactivate it?


I didn’t found an option for that anywhere so this is the solution: Remove the .idea/vcs.xml file and restart PHPStorm.

Ref: How to disable version control in phpstorm?

Unserialize strings with special characters in PHP

After several hours having problems with serialized object with spanish texts in it, finally this function I found in worked like a charm:

function mb_unserialize($string) {
    $string = preg_replace_callback(
        function ($matches) {
            if ( isset( $matches[2] ) )
                return 's:'.strlen($matches[2]).':"'.$matches[2].'";';
    return unserialize($string);

For example:


class stdClass#1 (1) {
  public $text =>
  string(12) "áéíóúñ"


vi-vim options

You can change vi-vim options using the set command. To see current options just execute this:


To see all available options:

:set all

To set a value for an specific option, for example ruler:

:set ruler

Or file encoding:

:set fileencoding=utf-8

This is how it looks if you set ruler (display some info about the file and cursor position at the bottom) and number (display line numbers on the left side):


To set the default value for some options edit ~/.vimrc:

set ruler
set number

Use SSH config file to easely connect to servers via alias names

I don’t have a very good memory and always have problems remembering my servers names when connecting to them via SSH. I usually used this “solution”:

$ history | grep ssh

Yep… not very neat. A friend (follow him, you’ll learn lots of things!) told me I could use Control+Shift+R in the terminal and It was like “OMG! This is great!”. After pressing that key combination you can start typing a command and you’ll get matches to previous commands with that text, so all I had to do was type “ssh” and then press enter. Magic!


But today I found another way that involved using the ~/.ssh/config file. The first step is to create this file in the correct place and, most important, with the correct permissions:

$ touch ~/.ssh/config
$ chmod 600 ~/.ssh/config

Now lets suppose we usually connect to a server called with a user named myuser. We can add this to ~/.ssh/config:

Host vps1
  User myuser

And here comes the cool part: now we can connect to this server with that user name by just typing this:

$ ssh vps1

That’s it. And of course you can add more and more configurations to it:


And if we also have enabled the connection using public/private keys we don’t even have to write a password.

This file is very heplful for other things too. For example you can make speed up SSH if you configure ControlMaster because it enables the sharing of multiple sessions over a single network connection.

Host *
  ControlMaster auto
  ControlPath ~/.ssh/ssh_mux_%h_%p_%r

If you get this error while connecting after configuring this it’s very likely because the ControlPath route does not exists or is write protected:

muxserver_listen bind(): No such file or directory


Enable hosting files outside /var/www in Apache2

I’m using Ubuntu and Mac OS X in my computer. I wanted both to share a partition to put all the things that could be duplicated in both systems: DropBox, downloads, music, etc. The websites I’m developing would be also there but I was getting 403 errors all the time. Anything outside /var/www won’t work. Finally I found out that there is a Directory configuration in /etc/apache2/apache2.conf that denies access to anything outside /var/www and /usr/share:

<Directory />
       Options FollowSymLinks
       AllowOverride None
       Require all denied

<Directory /usr/share>
        AllowOverride None
        Require all granted

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

To fix this you can disable the first Directory block or even better add a new one with Require all granted in it for your speceific path:

<Directory /home/shared/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted