Warning: getimagesize(/home/benc/public_html/../../../../../../../../../../../../../../../../../../../../tmp/fb125.jpg) [function.getimagesize]: failed to open stream: No such file or directory in /home/benc/public_html/wp-content/plugins/yet-another-photoblog/lib/YapbImage.class.php on line 438

Warning: getimagesize(/home/benc/public_html/../../../../../../../../../../../../../../../../../../../../tmp/pista.png) [function.getimagesize]: failed to open stream: No such file or directory in /home/benc/public_html/wp-content/plugins/yet-another-photoblog/lib/YapbImage.class.php on line 438
Random archive | Ben Cornwell

Archive for the 'Random' Category

 

CITCON

Jun 27, 2008 in Random

CITCON 2008 kicked off earlier this evening in Melbourne.

More to follow tomorrow!

Fail

Jun 26, 2008 in Random

Fail

I’m not normally one to partake of stealing posts from other blogs, but this is just too good to resist.

Lifted from FailBlog.org

PHPUnderControl (Install cont.)

Jun 25, 2008 in Random

In a previous post, I mentioned I would post the init script I’ve been using to start/stop CruiseControl. It’s not my own work (lifted from teh Internets). Looks like it was originally written by someone from ThoughWorks, but I didn’t find it on a ThoughWorks site & it didn’t come with a licence or copyright notice. Until I’m told otherwise, I guess it’s OK to redistribute.

Download it here

Obviously you’ll need to configure the script for your environment and allocate appropriate permissions. When you’re done, drop it into /etc/init.d/ and CruiseControl will automatically start during your server’s init routines. Also, when trying to stop the process, rather than scanning ps output trying to find the correct pid to kill, you just run:

# sudo /etc/init.d/cruisecontrol stop

Bianchi Pista

Jun 20, 2008 in Random

Bianchi Pista

I’m building a bike! Bought a frame through Ebay last week which should be arriving any day now. More pics from the build will turn up here.

National Ride to Work Day

May 31, 2008 in Random

Registrations for National Ride to Work Day (October 15th) have opened over on the Bicycle Victoria website, http://www.bv.com.au/join-in/126/. Obvious health benefits aside, commuting by bike has a positive impact on the environment, helps protect from the inanity of public transport, and it’s also good fun. You should go sign up!

teh orsum

May 14, 2008 in Random

OSDC 2008 - Call For Papers

May 11, 2008 in Random

The Call For Papers for this year’s Open Source Developers Conference has just opened:

http://osdc.com.au/2008/papers/cfp.html

I’ll probably be submitting a paper, but yet to decide on a topic.

PHP Melbourne - May Meeting

May 02, 2008 in PHP, PHPMelb, Random

www.PHPMelb.org

Thursday May 8th, 7pm
580 St Kilda Road Melbourne  
 
CodeSniffer. You need it. You want it. Be there. - Avi Miller - 7:00 - 7:45 pm
 
PHP_CodeSniffer is a PHP5 script that tokenises and “sniffs” PHP and JavsScript code to detect violations of a defined set of coding standards. It is an essential development tool that ensures that your code remains clean and consistent. It can even help prevent some common semantic errors made by developers.
This talk will show you how to use PHP_CodeSniffer to ensure your PHP and JavaScript adheres to your chosen coding standard. We will also look at how to create a new “sniff” that will check a particular coding standard requirement.
Avi is the MySource Matrix Product Evangelist for Squiz. As Product Evangelist, he is contractually obliged to deeply love MySource Matrix, a state greatly enhanced by strict adherence to coding standards (great plug!). Additional daily duties include pre-sales consulting, business analysis, information architecture, hand-holding, nappy changing and other professional tasks.
 
 
MySQL Stored Procedures -  Ben Balbo - 8:00 - 8:45 pm
 
A recent addition in MySQL 5, stored procedures allow us to automate or program our way out of many tasks directly on the server rather than having to write external scripts to do complex manipulation of data. Stored procedures can also be used to simplify data validation or enforce access control. In this talk, Ben will use a few simple stored procedures and views to demonstrate their power and usefulness, not to mention the benefits that can be reaped when the database needs refactoring.
 
Socialising & Networking 9:00pm onward

Pizza, softdrink, tea, coffee and comfy swivel chairs will be provided
with compliments of our major sponsor, Hitwise.

Australia Joins Kyoto

Dec 03, 2007 in Random

From The Age:

…Australia has moved to ratify the treaty in the first official act of the Rudd Labor Government.

Within hours of being sworn in yesterday as Australia’s 26th Prime Minister, Kevin Rudd had moved to honour Labor’s long-standing pledge to ratify the treaty, which legally commits the nation to an emissions target of 108% of 1990 levels by 2012.

Federal Opposition Leader Brendan Nelson immediately backed the decision - marking a major departure from the era of John Howard, who as prime minister steadfastly refused to ratify Kyoto on the grounds it would harm the economy and did not bind developing nations such as China and India.

No greats surprises in this, although it could have easily turned out to be yet another empty campaign promise. It’s good news though, finally we’ve got a leader who can recognise when decisive action is required and stand up to commercial interests in doing something about. It’s only a small step, but it is a positive one!

PHP 6 Installation Guide for Ubuntu 7.10 (Gutsy Gibbon)

Nov 18, 2007 in PHP, Random

It’s no longer news that next release of PHP is on it’s way. If you’re like me, you’re probably pretty keen to start experimenting with the new features, enhanced OO, and rejoice at the demise of ‘register_globals’. The only problem is: PHP 6 doesn’t have packaged releases just yet. In other words, if you want to start working with PHP 6, you need to compile it from source. To most Linux nuts, compiling source code is an everyday task. However if you’re not familiar with rolling your own binaries, the process can seem daunting, and with that in mind I decided to write a guide to compiling PHP 6.

Environment

I wrote this guide specifically for Ubuntu 7.10, and while most steps will work successfully for most flavors of Debian Linux, bear in mind that some commands and file system locations may need to change depending on the system you’re running. You’ll need administrative privileges to execute many of the steps described in this guide, so if your account isn’t already on the sudoers manifest, you might want to correct that first. I recommend using a virtual machine as a sandbox for experimental environments. This way, should anything go toes-up along the way, you won’t have damaged your regular working environment (VMWare server is free and does the job nicely).

Some Prerequsites

Before we can get started compiling PHP, there a few tools needed during the installation process that we’ll need to install first:
* libtool - GNU shared library manager
* bison - grammar parser
* flex - another source code parser
* re2c - lexical scanner
* g++ - GNU compiler collection (the c compiler)
* libxml2-dev - XMl libraries (a non-bundled dependency of PHP)
* autoconf - configures source code for compiling
* automake - used to build compiler instructions (’make’ files)

To install these packages, fire up a terminal window and enter:

sudo apt-get install libtool bison flex re2c g++ libxml2-dev autoconf automake

Once that’s done, you’ll have all the tools you need to compile ICU (International Components for Unicode) & then PHP 6.

Compiling and Installing ICU

One of the major features coming in PHP 6 is support for Unicode, and the ICU library is what provides unicode capability to PHP. To compile & install ICU, run the following commands in your terminal session:

mkdir ./icu_source
cd icu_source
wget ftp://ftp.software.ibm.com/software/globalization/icu/3.6/icu4c-3_6-src.tgz
tar -xf ./icu4c-3_6-src.tgz
cd icu/source
sudo mkdir /usr/local/icu
sudo ./configure --prefix=/usr/local/icu
sudo make
sudo make install

Install Apache

This step is optional, but if you’re like 99% of PHP developers (myself included), chances are you’ll want to use your PHP 6 install with Apache. Note that you need the non-threaded version of apache - because while PHP is not thread-safe, many of the PHP extension libraries are not. To install non-threaded Apache, run the following command:

sudo apt-get install apache2-mpm-prefork

Getting PHP 6 Source Code

The best place to get PHP 6 source code is from http://snaps.php.net/. The version I’m using in this guide was built on 17th of November 2007. Before carrying out these steps, you might want to check if a new version is available and use that instead. Here’s how to download & unpack the PHP 6 source code:

cd
mkdir ./php_source
cd ./php_source
wget http://snaps.php.net/php6.0-200711170930.tar.bz2
tar -xf ./php6.0-200711170930.tar.bz2
cd ./php6.0-200711170930

PHP 6 Configuration

You need to configure your PHP build so the compiler knows which libraries and extensions you want supported. This is done using a configure script, like this (no need to use new lines, I’ve just done that to make the command easier to read):

sudo ./configure --prefix=/usr/local/php6
--enable-bcmath
--enable-calendar
--enable-dba
--enable-exif
--enable-ftp
--enable-gd-native-ttf
--enable-soap
--enable-sqlite-utf8
--enable-wddx
--with-apxs2=/usr/bin/apxs2
--with-gettext
--with-iconv
--with-openssl
--with-pcre-regex
--with-pdo-sqlite
--with-sqlite
--with-zlib
--enable-zip

You don’t need to compile PHP 6 with support for *all* these libraries & extensions, however this is the default set of configuration options being used by the QA team doing the testing on PHP 6, hence this is also the configuration I’m recommending.

Heads-Up Apache Users!

Due to a quirk of apxs2 (the tool that builds and links the PHP executable module for apache), you’ll need to hack a commented-out dummy LoadModule directive into your httpd.conf. You can get more info on why this is necessary from (http://www.trachtenberg.com/blog/2004/08/25/apxs2-causes-php-install-to-barf-under-suse-91-and-apache-2/). It’s a shame apxs2 doesn’t have a nicer solution, but at least there’s a simple work-around. Open up you httpd.conf file in your favourite text editor (here, I’m using vim):

sudo vim /etc/apache2/httpd.conf

Add the following line, save and close the file:

#AddModule foo_module /usr/lib/apache2/modules/foo.so

The Crunch

Once the configure script has finished running (and you’ve put the dummy entry into httpd.conf), it’s time to compile the binaries (this process should look familiar from compiling & installing ICU). Just run the following commands.

sudo make
sudo make install

Note that the steps above can take a while to run - usually about 10 to 15 minutes, depending on the specs of your computer.

PHP 6 is Now Yours!

If you’d like to run a quick check to test everything has gone according to plan, do this:

/usr/local/php6/bin/php --version

You should see something like the following:

PHP 6.0.0-dev (cli) (built: Nov 17 2007 22:57:15)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2007 Zend Technologies

Hooking Up With Apache

Lastly, if you want to use PHP 6 with Apache, you’ll need to configure the web server to use your swanky new PHP 6 binaries. First, add the configuration directives (again, I’m using vim here, but feel free to use whatever text editor you’re comfortable with):

sudo vim /etc/apache2/mods-available/php6.conf

Now add the following configuration section to the php6.conf file, save then close:

<IfModule mod_php6.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
</IfModule>

Now you need to tell Apache where to find the PHP 6 module:

sudo vim /etc/apache2/mods-available/php6.load

Add the following line, then save and close the file.

LoadModule php6_module /usr/lib/apache2/modules/libphp6.so

At this point, it would probably be a good idea to remove the ‘hacked in’ LoadModule directive from /etc/apache2/htttpd.conf (See the section above called ‘Heads-up Apache Users’). It shouldn’t break anything if you don’t though. Apxs2 will have also added an additional LoadModule for php6 below the dummy entry - it’s safe to remove this as well, because we’ve just added the same thing to in the php6.load file.

Once you’ve finished editing the apache config files, enable the new module by running

sudo a2enmod php6

Finally, restart Apache so the configuration changes take affect:

sudo /etc/init.d/apache2 restart

If you knock together a quick script calling phpinfo(), you should now be seeing “PHP6.0.0-dev”!

Enjoy!

By the way: If you’re interested in hearing exactly what’s coming in PHP and you’re in Brisbane next week, come along to the Open Source Developers’ Conference, where I’ll be giving a presentation: “PHP 6 - What’s In, What’s Out and Why”