Author Archives: zechim - Page 4

Install composer

Composer is a dependency management for PHP and writen in PHP

curl -s https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/
alias composer='/usr/local/bin/composer.phar'

List empty directories on Ubuntu

find your/path -depth -empty -type d

Add PHPUnit to your Include Path (eclipse based IDE)

1 – Choose “Project” -> “Properties” or “Window” -> “Preferences” -> “PHP” (for global usage)
2 – Choose “PHP Include Path”
3 – Click on “Add External Source Folder” (typically PHPUnit is based on /usr/share/php/PHPUnit for linux distro)

Backup / Export users from MySql

put this on your ~/.bashrc

mygrants()
{
  mysql -B -N $@ -e "SELECT DISTINCT CONCAT(
    'SHOW GRANTS FOR ''', user, '''@''', host, ''';'
    ) AS query FROM mysql.user" | \
  mysql $@ | \
  sed 's/\(GRANT .*\)/\1;/;s/^\(Grants for .*\)/## \1 ##/;/##/{x;p;x;}'
}

usage

mygrants --host=[HOST] --user=[USER] --password=[PASSWORD]

I found this solution on: http://bit.ly/JMFCOd

List installed / loaded modules on apache2

sudo apache2ctl -M

Enable htaccess rewrite on Apache2 Ubuntu 12.04

sudo a2enmod rewrite

Edit /etc/apache2/sites-available/default, change “AllowOverride None” to “AllowOverride All”

sudo service apache2 restart

Ignore chmod changes on GIT

git config core.filemode false

thanks Piero http://twitter.com/#!/pierophp

PHPMyAdmin install on ubuntu

sudo apt-get install phpmyadmin
sudo cp /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
sudo service apache2 reload

Desktop Shorcut on Ubuntu

gnome-desktop-item-edit --create-new ~/Desktop

Install PHPunit on Ubuntu

Install the package

sudo apt-get install phpunit

Upgrade PEAR

sudo pear upgrade pear

Install all the dependencies

sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
sudo pear install --alldeps phpunit/PHPunit

Test

phpunit --version

update
If you have any problem you can try this:
http://stackoverflow.com/questions/9186000/call-to-undefined-method-php-codecoverage-filtergetinstance

Page 4 of 10« First...23456...10...Last »