Pragmatism in the real world

Redirecting email whilst developing

One common problem whilst developing is that you don't want to send emails out to the client (or their clients!). Ideally, we want to alter our development environment so that this doesn't happen, but still allows us to test the contents of emails that are sent by our web applications. Windows On Windows, the mail() function uses SMTP over port 25. Unless you've changed your php.ini file, then it will try to connect to localhost… continue reading.

PHP Advent 2009: On deployment

This year I was asked to write an article for PHP Advent 2009 an it's now been published! Automate your Deployment is a look at how to automate the process of deploying your application to the web server. At my company we started automating our deployment systems just over a year and the number of issues we have around deployment of new code to a website has dropped considerably and is no longer a stressful… continue reading.

Setting up PHP & MySQL on OS X 10.6 Snow Leopard

(Updated 1st May 2010) With OS X 10.6, Apple ships PHP 5.3 with PEAR, GD and PDO_MYSQL out of the box. Also, everything is now 64bit. This means that the entire effort required to get a working PHP dev environment for my work is now much easier. /usr/local Ensure that the following directories exist: sudo mkdir /usr/local/include sudo mkdir /usr/local/bin sudo mkdir /usr/local/lib sudo mkdir -p /usr/local/man/man1 MySQL Download the 64bit DMG version of MySQL… continue reading.

Some notes on Zend Server CE for Mac OS X

I've installed Zend Server CE on my Mac to see where it's got to and it's looking quite usable. The installation puts everything into the usr/local/zend directory which is fairly well laid out so that you can find what you are looking for. There's also a a nice admin system at http://localhost:10081 which allows you to restart PHP, view phpinfo(), configure extensions and php.ini. There's also a phpMyAdmin to help administer the bundled MySQL server.… continue reading.

UTF-8, PHP and MySQL

Everyone else probably already knows this stuff, but I hit an issue today to that took a while to sort out. Fortunately, some kind folks on IRC helped me, but as it's embarrassing to ask for help on the same issue twice, I'm writing down what I've learned! The problem Get a £ character stored to MySQL, retrieved and then displayed without any weird characters in front of it using UTF-8. The solution Make sure… continue reading.

Setting up PHP on OS X Leopard

In the vein of some of Lorna's articles, this is more a note for myself than anything else. Not everything is explained in detail as it assumes you know how to use a command line… These are the steps I take to get the Apple supplied PHP working with GD, PDO_MySQL and Xdebug working on OS X 10.5. /usr/local Ensure that the following directories exist: sudo mkdir /usr/local/include sudo mkdir /usr/local/bin sudo mkdir /usr/local/lib sudo… continue reading.

Where is php ?

A question came up on the phpwomen channel today about how to find the path to php executable for use in cron scripts. The answer that came back very quickly to use which or whereis. It turns out that the server in question is a shared host with a control panel for access to cron and ftp to upload your files. A test proved that shell_exec() wasn't going to work too. After discussing it for… continue reading.

Recursion

PHPWomen are running an article contest at the moment. All you have to do is write an article for the Best Practices forum and you could win a Zend Studio for Eclipse license and a a 1-year subscription to Linux Pro magazine! Obviously, never one to miss an opportunity to win free swag, I've entered with an article on recursion. Now it's your turn. Write a article on a best practice when coding PHP, but… continue reading.

PHPWM March Meeting: Symfony

On Tuesday, PHPWM had a meeting at PSL Connect's offices where Darren Beale talked about Symfony. I took a few pictures and have stuck them up on Flickr. I should have taken my other lens though as the 50mm isn't wide enough for taking pictures in room! It was a very good talk that covered the basics of Symfony and what it can do. At the start, Darren asked us which frameworks we use and… continue reading.

Code cleanliness guidelines from Etienne Kneuss

I don't often post links to articles I read via my RSS reader as I assume that most people who read this blog also read sites like Planet PHP, PHP Developer or DevZone. Having said that, Etienne Kneuss has posted an article aimed at less experienced PHP programmers providing some quick guidelines to code cleanliness which are actually a very good reminder to us all.