Saturday, February 19, 2011

Quickly rename files to lower case

Here is a simple bash oneliner to rename all folders/files in a directory to lower case

for old in * ; do new=`echo $old | tr "[[:upper:]]" "[[:lower:]"`; mv $old $new;  done;

Monday, February 14, 2011

Getting PHP's pcntl working on Snow Lepard

(make sure you've installed Apple's developer tools)


1. Check your version you have installed and download the PHP source code.

$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:55)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans

$ curl -O http://us.php.net/distributions/php-5.3.3.tar.gz


2. unpack, phpize, configure, make, make install

$ tar -xzvf php-5.3.3.tar.gz
$ cd php-5.3.3/ext/pcntl/
$ phpize
$ ./configure
$ make
$ sudo make install


3. Add "extension=pcntl.so" to your /etc/php.ini

4. Confirm

$ php -i | grep pcntl
pcntl
pcntl support => enabled


Done