Install multiple version of php

git clone git:// .phpenv
echo ‘export PATH=”$HOME/.phpenv/bin:$PATH”‘ >> ~/.bash_profile
echo ‘eval “$(phpenv init -)”‘ >> ~/.bash_profile
exec $SHELL
phpenv rehash

sudo apt-get install libxml2-dev
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install libmcrypt4 libmcrypt-dev
sudo apt-get install libreadline-dev
sudo apt-get install libtidy-dev
sudo apt-get install libxslt1-dev
sudo php-build -i development 5.3.28 $HOME/.phpenv/versions/5.3.28

phpenv versions
phpenv rehash
phpenv global 5.4.9
php –version
phpenv global system
php –version

extension dir: /home/tien/.phpenv/versions/5.3.28/lib/php/extensions/no-debug-non-zts-20090626/
config dir: /home/tien/.phpenv/versions/5.3.28/etc/php.ini

Ubuntu 14.04
system: 5.5.9…


Exclude directory from grep search

  1. If we want to exclude abc/ and xyz/ directory (in root directory) form grep’s results we can do this:
    grep -rn –exclude-dir={abc,xyz} “text to find”
  2. If we want to exclude abc/def/some_thing_special/ghi…:
    grep -rn –exclude-dir={some_thing_special} “text to find”
  3. Do you know how to exclude the whole directory path?

Fix Waiting For Connection (netbeans-xdebug) in Netbeans

  1. This is the old and buggy xdebug config: [Xdebug] ;zend_extension=/usr/lib/php5/20121212/ ;xdebug.remote_host= xdebug.remote_connect_back=1 xdebug.remote_enable=1 xdebug.remote_autostart = 1 xdebug.remote_handler=”dbgp” xdebug.remote_port=9000 xdebug.profiler_enable=0 xdebug.profiler_enable_trigger = 1
  2. This is new and stable xdebug config: [xdebug] ;zend_extension=/usr/lib/php5/20121212/ xdebug.remote_host= xdebug.remote_enable=1 xdebug.remote_autostart = 1 xdebug.default_enable = 1 xdebug.remote_handler=dbgp xdebug.remote_port=9000 xdebug.idekey=”netbeans-xdebug” xdebug.profiler_enable=1 xdebug.profiler_enable_trigger = 1
  3. sudo vim /etc/php5/apache2/php.ini
  4. Change to new config
  5. sudo vim /etc/php5/cli/php.ini
  6. Change to new config
  7. sudo service apache2 restart
  8. Disable ‘Watches and Balloon Evaluation’ in netbeans
  9. Restart netbeans

Install thelia


  1. Get code
    git clone
  2. Change version of propel
    open composer.json
    update version of propel: “propel/propel”: “2.0.0-alpha2”,
  3. Create a virtual host:
    <VirtualHost *:80>
    DocumentRoot /path/to/thelia/web
    <Directory /path/to/thelia/web>
    # enable the .htaccess rewrites
    AllowOverride All
    Require all granted
    ErrorLog /path/to/thelia/error.log
    CustomLog /path/to/thelia/access.log combined
  4. Enable vhost alias
    sudo a2enmod rewrite vhost_alias
  5. Install dependencies
    cd /path/to/thelia/
    composer self-update
    composer update
  6. Fix permissions
    chmod a+w -R /path/to/thelia/cache/
    chmod a+w -R /path/to/thelia/log/
    chmod a+w -R /path/to/thelia/local/config
    chmod a+w -R /path/to/thelia/local/session
    chmod a+w -R /path/to/thelia/local/media
  7. Edit php.ini
    sudo vim /etc/php5/apache2/php.ini
    post_max_size = 100M
  8. Chown web/
    sudo chown user:www-data -R web/
    sudo chmod a+w -R web/
  9. Create datable and import structure
    create thelia database
    import install/thelia.sql for database structure
    import install/insert.sql for configurations
  10. rm local/config/database.yml
  11. go to and follow the instructions
  12. Import realistic productions
    php install/import.php