Posts tagged “php”

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

Closing PHP tag considered harmful

A good tip from Zend, who recommend omitting the closing PHP tag (?>) when your files contain pure PHP code. This can prevent additional whitespace being inserted into the script output. Extra whitespace can cause problems, for example, if you are trying to set your own custom HTTP headers: nothing should be output before the [...]

Installing PEAR on Mac OS X 10.5 Leopard

PEAR was removed by Apple from 10.5 for one reason or another. Here's how to get it back: Pre-requisties Make sure you have a php.ini file in /etc/. This isn't available by default. To create one enter the following: sudo cp /etc/php.ini.default /etc/php.ini PEAR Install cd curl -O http://pear.php.net/go-pear sudo php go-pear This starts the [...]

The Problem with PEAR

I have a love-hate relationship with PHP's class repository (and answer to Perl's CPAN), PEAR. Sometimes you can find very useful, well documented and cleanly implemented packages. And obviously re-using such components is a big-win. Sadly, the quality of PEAR varies wildly and frequently I stumble upon useful looking packages that have little or, worse, [...]

Java fighting a losing battle

Interesting article from Zend co-founder Andi Gutmans on how the Java world is leveraging dynamic languages such as Ruby and PHP in order to remain relevant in the web application world. The obvious question is, though, whether using JRuby has enough advantages over using Ruby or PHP in a plain Linux environment without a JVM. [...]