Posts tagged “php”
Install mcrypt PHP extension on Mac OS X Lion
If you have a need to install the mcrypt extension for PHP, for example if you need to use phpMyAdmin, then these instructions are for you. Thankfully, it is becoming simpler to install PHP extensions than with previous versions of OS X. Xcode The Xcode package installs the necessary versions of tools like autoconf which [...]
Mac OS X Lion PHP upgrade – php.ini and Suhosin
If you have upgraded from Snow Leopard to the new OS X Lion, you will notice PHP has also been upgraded – from 5.2 to 5.3. A couple of points that I noticed post-install. Firstly, my existing /etc/php.ini file was moved to /etc/php.ini-5.2-previous. Restoring this was trivial: sudo cp /etc/php.ini-5.2-previous /etc/php.ini However, I noticed that [...]
Install memcached PHP extension on OS X Snow Leopard
memcached is a very useful memory object caching system, which can be used to increase the performance of your dynamic scripts by caching database calls. This guide will explain how to install the memcached system, including the PHP extension, on Mac OS X 10.6. Xcode The Xcode package installs the necessary versions of tools like [...]
Fix PHP timezone warnings in OS X Snow Leopard
The standard Mac install of PHP has always been somewhat quirky, and 10.6 is no exception. One of the most obvious issues occurs when attempting to use date/time functions. PHP 5.3 requires that the date.timezone setting is available. Without this, you will receive a warning similar to the following: Warning: getdate() [function.getdate]: It is not [...]
PHP 5.3: The Good, the Bad and the Ugly
PHP 5.3 was released today; here are my positive and negatives: The Good: Closures Anonymous functions created with create_function have always been a bit messy. With 5.3 comes support for closures with a much cleaner syntax: $greet = function($name) { printf(“Hello %s\r\n”, $name); }; $greet(‘World’); $greet(‘PHP’); The Bad: Backwards incompatible changes Although not a massive [...]
mcrypt support for PHP on 64 bit Mac OS X 10.5
Please note: The article below refers to installing mcrypt on Mac OS X 10.5. If you have 10.6 Snow Leopard, please see my updated guide: Install mcrypt PHP extension on OS X Snow Leopard Adding additional functionality to the standard Apple-supplied PHP on Mac OS X 10.5 is a little tricky if you are running [...]
PHP Best Practices #2: Strictures
Make sure PHP is reporting all errors and warnings. Warnings and notices are PHP’s way of letting you know that you are utilising features in a non-standard way. If your code is omitting errors, then it should be fixed as soon as possible. Strict warnings are a class of errors that are turned off by [...]
PHP Best Practices #1: Regular expressions
preg not ereg This is the first in what I hope will be a regular series of posts on PHP best practices, inspired in part by Damian Conway’s Perl Best Practices book. Historically, PHP has had two incompatible regular expression engines available, POSIX Extended and PCRE (Perl Compatible Regular Expressions). Arguably, Perl-compatible regular expressions are [...]
PhpDocumentor in 5 minutes
Introduction This is a quick and dirty guide to the absolute minimum you need to get up and running with PhpDocumentor. One of the slightly off-putting aspects of PhpDocumentor is the amount of tags (`@`) that are available, which can initially be overwhelming. e.g. see PEAR example: PEAR sample file This guide shows you the [...]
Closures in PHP 5.3
A good article from IBM’s developerWorks on the new functional programming features in the upcoming release of PHP 5.3: What’s new in PHP V5.3, Part 2: Closures and lambda functions