Continuous integration for PHP with phpUnderControl

Whenever I start a new PHP project for a client, one of the first things I set up is usually phpUnderControl - a CI (continuous integration) server specifically for PHP built on top of CruiseControl. ...

May 13, 2011 · 12 min · Dave Perrett

Security testing with Google's ratproxy

Ratproxy is a passive web application security assessment tool released by Google. Basically you set it up as a proxy server between yourself and the target site, and then click around in the target site doing whatever it is you normally do, while ratproxy analyzes your activity in the background and looks for security holes. ...

September 24, 2010 · 6 min · Dave Perrett

Browser detection with PHP

You can use PHP’s get_browser() function to find out information about user’s browsers, but it takes a little setting up. ...

June 23, 2008 · 2 min · Dave Perrett

PHP5 on OS X Leopard

PHP5 is already installed on Leopard by default - all you have to do is turn it on. First, turn on web sharing - go to System Preferences->Sharing and make sure the ‘Web Sharing’ option is turned on. ...

June 23, 2008 · 1 min · Dave Perrett

Setup 64bit CentOS (PHP5, MySQL, memcached, ketama)

I recently had to set up a few CentOS servers with PHP , MySQL , memcached and ketama, and ended up writing this script to do it. You can grab the whole thing from subversion (you’ll need the php folder as well). ...

June 23, 2008 · 3 min · Dave Perrett

Format JSON with PHP

...

March 11, 2008 · 2 min · Dave Perrett

Multibyte-safe CSV Parser

I recently had to write a PHP CSV parser for a project, and found the built-in fgetcsv function fairly useless for real-world CSVs (where some fields are quoted and some aren’t for example, or where escaped delimiters or quotes are present inside the field text). This function should handle : Lines where some fields are quoted and some aren’t Lines where quoted fields have ’escaped’ quotes inside them Lines where non-quoted fields have ’escaped’ delimiters inside them Lines where the quote is ’escaped’ by another quote (the default behaviour for Excel CSV exports) Lines containing multi-byte strings ...

August 9, 2007 · 2 min · Dave Perrett

Add Dreamweaver Extensions

To colour-code a new extension ( .ctp CakePHP templates for example ), edit the file C:\Program Files\Adobe\Adobe Dreamweaver CS3\configuration\Extensions.txt and add the .ctp extension to the first line ( All Documents ) and the PHP Files section : ...

June 4, 2007 · 1 min · Dave Perrett

External Sessions in CakePHP

If you are using CakePHP in conjunction with an existing PHP application, chances are you need to import the normal application’s session into cake. Create a file called session_import.php or something similar in your cake app/config directory with the following contents : ...

June 4, 2007 · 2 min · Dave Perrett

Multiple DBs in CakePHP

Edit : To avoid confusion, cake has quite a nice mechanism for defining multiple DBs already (the database.php file), and if you only want to define a finite set of DBs, this is not the way to do it. This method is only useful if you want to have multiple DBs with the same structure (a database for each customer, for example). ...

June 4, 2007 · 7 min · Dave Perrett