Saturday, August 13, 2011

PEAR not installed by default on Snow Leopard and later

In OSX Snow Leopard and later pear isn't installed by default. The installer is already available to you though.

sudo php /usr/lib/php/install-pear-nozlib.phar
pear config-set php_ini /private/etc/php.ini
pecl config-set php_ini /private/etc/php.ini
sudo pear upgrade-all

If you're using php for the first time on osx you may also need to copy this config file into existance.
(normally I'd use vim but to not explain vim we're using nano here)
sudo nano /private/etc/apache2/httpd.conf
Delete the # from the line that reads:
#LoadModule php5_module libexec/apache2/libphp5.so


cd /private/etc
sudo cp php.ini.default php.ini


And since you're already messing with PEAR, we really should take full advantage of this opportunity to install PHPUnit.

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 phpunit/PHPUnit

If you have issues running phpunit a common cause is a misconfigured php.ini where the include path needs to be updated to:

include_path = ".:/usr/lib/php:/usr/lib/php/pear"

Thursday, August 11, 2011

Adding a mime type to IIS vis powershell

You must have the WebAdministration snappin or module loaded (this should come as part of the IIS install) then simply:

add-webconfigurationproperty //staticContent -name collection -value @{fileExtension='.otf'; mimeType='application/octet-stream'}