Skip to main content

· One min read
Tien
  1. sudo apt-get install python-setuptools
  2. sudo easy_install xdebugtoolkit
  3. sudo apt-get install graphviz
  4. sudo apt-get install php5-xdebug
  5. [xdebug] xdebug.profiler_enable=1 xdebug.profiler_enable_trigger=1 xdebug.profiler_output_dir=/tmp/xdebug
  6. Add a trigger to a page you want to profiling http://example.com/file.php?XDEBUG_PROFILE=1
  7. cg2dot /tmp/cachegrind.out.7340 | dot -Tpng -o ~/xdebug-all.png

· One min read
Tien
  1. Upgrade php5.5 http://www.dev-metal.com/how-to-setup-latest-version-of-php-5-5-on-ubuntu-12-04-lts/
  2. sudo pear install channel://pear.php.net/VersionControl_SVN-0.5.1
  3. sudo pear install channel://pear.php.net/VersionControl_Git-0.4.4
  4. sudo pear install channel://pear.php.net/Services_Amazon_S3-0.4.0
  5. sudo pear install channel://pear.php.net/XML_Serializer-0.20.2
  6. sudo pear install pear/PHP_CodeSniffer
  7. sudo pear install --alldeps phing/phing

· One min read
Tien
cd ~
git clone git://github.com/phpenv/phpenv.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...

Ref:

· One min read
Tien
  1. vim ~/.phpenv/versions/5.3.28/etc/php.ini pdo_mysql.default_socket="/var/run/mysqld/mysqld.sock"
  2. mv ~/.drush/php.ini ~/.drush/php.ini_bak
  3. cp ~/.phpenv/versions/5.3.28/etc/php.ini ~/.drush/
  4. php -m | grep intl
  • Download php5-intl_5.3.10-1ubuntu3_i386.deb
  • extract
  • Copy intl.so to ~/.phpenv/versions/5.3.28/lib/php/extensions/no-debug-non-zts-20090626/
  • Add this line to the end of ~/.phpenv/versions/5.3.28/etc/php.ini
extension=intl.so
  1. php -m | grep mcrypt
  • Download php5-mcrypt_5.3.2-0ubuntu1_i386.deb
  • extract
  • Copy mcrypt.so to ~/.phpenv/versions/5.3.28/lib/php/extensions/no-debug-non-zts-20090626/
  • Add these lines to the end of ~/.phpenv/versions/5.3.28/etc/php.ini
[mcrypt]
extension=mcrypt.so
  1. Download libicu48_4.8.1.1-3ubuntu0.1_i386.deb and install it

· One min read
Tien
  1. Install, enable xdebug.
  2. export XDEBUG_CONFIG="idekey=netbeans-xdebug"
  3. Set break point and run script.
  4. If we run drush command (drupal), we (must?) update drush's php.ini
    cp /etc/php5/apache2/php.ini ~/.drush/php.ini

· One min read
Tien
  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?

· One min read
Tien
  1. This is the old and buggy xdebug config:
[Xdebug]
;zend_extension=/usr/lib/php5/20121212/xdebug.so
;xdebug.remote_host=127.0.0.1
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
  1. This is new and stable xdebug config:
[xdebug]
;zend_extension=/usr/lib/php5/20121212/xdebug.so
xdebug.remote_host=127.0.0.1
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
  1. sudo vim /etc/php5/apache2/php.ini
  2. Change to new config
  3. sudo vim /etc/php5/cli/php.ini
  4. Change to new config
  5. sudo service apache2 restart
  6. Disable 'Watches and Balloon Evaluation' in netbeans
  7. Restart netbeans

· One min read
Tien

xdebug 2.2.3 is very buggy on Ubuntu 14.04. We need to upgrade it. Here is how I done:

  1. php -i > ~/phpinfo
  2. Copy content of phpinfo and paste into http://xdebug.org/wizard.php
  3. Follow those steps:
    1. Download xdebug-2.3.3.tgz
    2. tar -xvf xdebug-2.3.3.tgz
    3. cd xdebug-2.3.3/
    4. phpize && ./configure && make
    5. sudo cp modules/xdebug.so /usr/lib/php5/20131226/

· One min read
Tien
  1. Get code git clone https://github.com/thelia/thelia.git
  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>
ServerName thelia.dev ServerAlias www.thelia.dev
DocumentRoot /path/to/thelia/web
<Directory /path/to/thelia/web> # enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
ErrorLog /path/to/thelia/error.log
CustomLog /path/to/thelia/access.log combined
</VirtualHost>
  1. Enable vhost alias
sudo a2enmod rewrite vhost_alias
  1. Install dependencies
cd /path/to/thelia/
composer self-update
composer update
  1. 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
  1. Edit php.ini
sudo vim /etc/php5/apache2/php.ini
# /post_max_size
# post_max_size = 100M `extension=mcrypt.so`
  1. Chown web/
sudo chown user:www-data -R web/
sudo chmod a+w -R web/
  1. Create datable and import structure
create thelia database
import install/thelia.sql for database structure
import install/insert.sql for configurations
  1. rm local/config/database.yml
  2. go to thelia.dev and follow the instructions
  3. Import realistic productions
php install/import.php