Archive for the 'PHP' Category

May 20 2008

Is Microsoft About To Buy Zend?

Published by under PHP,Programming,Technology

Microsoft has been trying to make itself F/OSS friendly recently.  From agreeing not to sue open source projects to working to provide a bridge between it’s proprietary source management system (TFS) and the much loved open source alternative SubVersion.  Microsoft seems to be trying its best but still appears to be keeping open source at arms length.

The question is: is Microsoft ready to get into bed with open source itself.  Enter Zend.  Zend is an Israeli company that has grown up around the open source scripting engine PHP.   Previously Microsoft announced that it would be working with Zend to provide better support for PHP under Windows Server.

In the last day or so it has become apparent that Zend is laying some of it’s staff. Erick Schonfeld has speculated that this may be to make Zend more attractive to a prospective purchaser.  With Microsoft on the verge of finally to a deal to buy (some if not all) Yahoo, it may Zend may also look attractive if Microsoft is to continue supporting the applications that Yahoo has running on PHP.

There is also the long awaited dynamic language support for .Net.  Maybe PHP could be leveraged to bring more hobbyist developers over to the .Net platform.  Obviously there is the question of getting the .Net framework ported over to alternative operating systems, however Silverlight has demonstrated that they might not be adverse to that idea.

Of course, Oracle has also previously shown an interest in PHP and it would sit nicely alongside MySQL, which that previously purchased.  And then there is IBM, who also seem to be embracing open source as their extensive use, distribution and support of Java show.

No responses yet

Feb 27 2007

Using MAMP on a Mac

Published by under PHP,Programming

I’ve had MAMP installed on my Mac since the day I got it. Yeah, yeah, laugh if you want but I find *AMP a fast platform for developing on and have used since my first year at Uni.

Anyhow, installing MAMP and getting it running was incredibly easy. In fact the installer did everything (so long as you use the default directories). For this reason I’m not going to be covering the basic installation. What I am going to cover is getting the MAMP installation setup as the default installation of PHP as used on the command line. I’ll also cover getting PEAR working on the command line and even as far as setting up Trax for use on the command line. For the article I’m going to assume you’re using the MAMP default settings with PHP5.

Once you have installed MAMP on your Mac you can use it like you would on a webserver, you just need to point you browser at http://localhost:8080. This is all good until you need to use PHP on the command line. If you type the following on the command line:

php -v

You’ll probably find that the output indicates that the command line version of PHP is 4.x and not PHP 5.x like you want it to be. The fix for this is quite simple, you just need to run the follow commands on the command line:

sudo mv /usr/bin/php /usr/bin/php-old
sudo ln -s /Applications/MAMP/bin/php5/bin/php /usr/bin/php

This will make the MAMP installed version of PHP the default on the command line. If you want to do the same for the MAMP installed version of PEAR then you need to do the following:

sudo mv /usr/bin/pear /usr/bin/pear-old
sudo ln -s /Applications/MAMP/bin/php5/bin/pear /usr/bin/pear

Now you can go ahead and use PHP and PEAR on the command line like all the installation guides and tutorials show you.

FInally, if you are installing PHPonTrax here are a few things that will make your life easier. The documents tell you to use the trax command. If you try this, however, you’ll probably get a message that the application trax cannot be found. To make trax available run the following command:

sudo ln -s /Applications/MAMP/bin/php5/bin/trax /usr/bin/trax
Also, when the trax documentation tells you to run php scripts on the command line always prepend it with php for example:

./generate.php model


php ./generate.php model

I hope this help alleviate some of your problems. If not, pour yourself a coffee, head over to and watch a couple of episodes, then drop me a comment asking for help. I may not know all the answers but I should be able to point you in the right direction.

Technorati Tags: , , , , ,

9 responses so far

Nov 24 2006

Back From The Brink

Published by under PHP,Site Work

Its nice to use a hosting service that keeps its customers informed.  Yesterday, just as I was about to leave work I noticed that my blog was offline. I hunted high and low last night but could I find the problem? Could I hell!

I’ve finally found the solution.  It seems that my hosting company silently upgraded both the PHP4 and PHP5 (although I only found a notice about the PHP5 upgrade.  Else where on teh intawebs I found the the latest version of PHP5 has got short PHP tag disabled, therefor <? ... ?> is not allowed, instead you have to use the long format <? ... ?>.

Now, don’t get me wrong, I don’t have a problem with using the long format, infact I prefer it. However, my hosting company (in its infinite wisdom) has decided to not show errors in the browser, instead I have to go to my hosting control panel, and the errors that are logged by PHP is simply:

PHP Parse error: syntax error, unexpected $end in [filename] on line 6

Why, oh why, can’t the error be something like “PHP Parse error: short tags disabled”.  That would have caused a lot less frustration on my part and for everyone that reads my blog.  Now I have to go through the rest of my site and try to find where else short tag have been used for PHP…. argghhhh!!!!

No responses yet

Nov 09 2006

Disecting A Self Counting MySpace Bulletin

Published by under PHP

I came across a MySpace bulletin that announced itself as “The only bulletin that counts how many times its been posted!”. If read someone elses bulletin all you need to do is click the link at the bottom and it loads up your own bulletin posting form for you to repost the bulletin with the latest posting count.

Being the inquisitive sort of person I am [trying to be]. I decided to take a look at how the bulletin works. Whilst it appears to work by magic, the code behind it is very simple. The link that you click in the bulletin to repost it is actually a link to This page contains a form on it that is the same as the MySpace bulletin posting form (only on a different server). The user never sees this form, however, as when the page is loaded javascript on the page automatically submits the form to MySpace.

But how does the count get updated? That’s very simple and comes down to three lines of code:

$count= read_file("count.txt");

What happens is when you click the repost bulletin link, the bullcount.php page opens up the count.txt file, reads the number, adds one and saves the number again. It then creates the bulletin post form (including the new count) and submits it for you. Quite simple really.

This is all very nice, however, unless you know what you are doing you’ll never know quite how far the bulletin has got to, even if you have a lot of friends on MySpace you’ll only get the latest count so long as your friends re-post the bulletin. So I propose an upgrade to this simple setup. Whilst it is not possible to dynamically change the number in the bulletin, we can change the number in the body of the bulletin. This can be done using a dynamically generated gif (a graphical representation of the number), which is very trivial in PHP and there are numerous scripts out there which do just this. The result would be that the bulletin title could indicate at which point the users joined the chain, and the image in the bulletin body would indicate how far it has got.

The current implementation relies on a simple text file but this can lead to all sorts of concurrency problems, especially if you have 100,000 users opening it for outputting to the gif, therefore this upgrade may require a change to using a DB that can handle locking but I’ll leave that for someone else to sort out.

If you’re planning on creating your own version the code required for the bulletin posting form is:

<form name="bulletinForm" action="" method="POST" target="_self">
<input type="hidden" name="groupID" value="0">
<input type="hidden" name="hashcode" value="MHsGCisGAQQBgjdYA8igbTBrBgorBgEEAYI3WAMBoF0wWwIDAgABAgJmAwICAMAECMDZad0h0zS3BBBjEFtHHZcIPZ22xHDNx80PBDB/bOdbTVXoblD/iQi1aMqvh//wZuk7RhaHgFKCy/h6bH0MSkrfs7r9H1gdk0fA69k=">
<input type="hidden" name="hash" value="6308J150O169O160O160O153O168O157O162">
<div style="visibility:hidden;display:none;">
<input type="hidden" name="subject" value="
echo("Let's see how big this can get. Repost number: $count");
" size="1" maxlength="50">
<textarea name="body" type="hidden" style="width: 0px; height: 0px;"><Center>
<font face="comic sans ms">
This is the only bulliten that counts how many times its been posted!<br>
So far this bulletin has been posted<br><big>
<?php echo("$count"); ?></big><br>
<a href="">
Click here to repost this bulletin</a><br>
<input type="submit" value="Click here if you're not automatically redirected.">

This code was “borrowed” from here… I assume they don’t mind me re-posting it as they did put the source code online :)

3 responses so far

Aug 29 2006

FAlbum & Lightbox Bug Fix

Published by under PHP

I’ve updated the latest version of my FAlbum with LightboxJS2 mashup in order to fix a bug that was brought to my attention by Martin. The error caused lightbox to fail to load when viewing the individual photo page. I have not bothered to update the version number as neither FAlbum nor WP-Lightbox versions have been updated.

THe fixed version can be downloaded from here ( or my downloads page.

Credit goes to:

31 responses so far

Aug 14 2006

FAlbum Lightbox with Pre-load

Published by under PHP

I’ve finally gotten around to updating my FAlbum lightbox mashup. This version adds a feature that several people have been asking for… pre-loading images so that users don’t click on them before the lightbox is loaded. I can’t take all the credit for this one, in fact I can probably take very little. All the ground work was done by Matthew Litherland and it appeared on his blog first.

I have also fixed a bug that has been in FAlbum for a while (I will be submitting a patch soon) which only allowed the default style to be selected in the Admin Options panel. You can now add more themes as you see fit. To celebrate this fix I have included a free style, for your use and abuse, called hemingway… after the name of the theme I’m using on this blog by Kyle Neath.

There is a slight bug when using IE to view the thumbnails, in that the image overlay doesn’t sit in the top left (as it should). This is because IE doesn’t play nicely with CSS as it works correctly with both Firefox and Opera. If anyone has a fix for this please send it over and I’ll be sure to credit you in the next release.

I’ve now stopped providing just the diff files as it was a right royal pain sorting them out and as I’m now including a modified wp-lightbox2 plugin – for the flickr link and image pre-loading – its a whole lot easier to bundle the whole lot together.

The new mashup can be download from here or my downloads page.

13 responses so far

Jul 12 2006

Wp-Lightbox2-Flickr Update

Published by under PHP,Programming

I made a mistake yesterday with my modified WP-Lightbox2 plugin. I have already noticed on one website that the site owner extracted the plugin to a folder called wp-lightbox2-flickr.

If you have also made this mistake then you need to rename the folder to wp-lightbox2. I have already renamed the folder that is in the archive file so future downloaders should be ok.

I will also try and change the plugin so that it doesn’t matter what the name of the folder is.

Sorry for any inconvenience caused.

Relates to: FAlbum Mashup – Second half

5 responses so far

Jul 11 2006

FAlbum Mashup – Second half.

Published by under PHP,Programming

I’ve completed the latest version of my FAlbum mashup and the files have been uploaded. This time I’m only releasing it as the complete plugin, this is because… well, I don’t really need a reason. I have also released a modified version of the Wp-Lightbox2 plugin to allow you to get the full set of features I have created.

The features this mashup provides (beyond the standard FAlbum features) are:

  • Overlay icon on thumbnails to provide access to Lightbox.
  • Link from lightbox image to Flickr photo page.

Now, if you do not click on the over link, you will go through to the FAlbum photo page. One thing to note about the Lightbox is that I will be trying to make it possible to navigate to images beyond the page you are currently viewing. This is due to the way the lightbox plugin works and I’m not about to re-write the lightbox.

To get the link in the lightbox through to the flickr page for the picture I have had to modify the Wp-lightbox2 plugin. The FAlbum mashup will work with the original version of the Wp-Lightbox plugin, you just wont get the Flickr link. Also, my modified Wp-Lightbox can directly replace the original plugin without requiring changes to any existing uses of the plugin. ie, its backwards and forwards compatible (as far as I have tested it).

All files are available from my downloads page.

Credit goes to:

7 responses so far

Jul 11 2006

FAlbum Mashup – A game of two halves.

Published by under PHP,Programming

Thanks to the people that have submitted suggestions and request. I am now half way through updating my mashup to work with FAlbum 0.6.6 and things seem to be going quite smoothly (apart from FAlbum only wants to use Default as the theme). So far I have managed to add a link to the Flickr page for the image that is currently being viewed in the lightbox (requires my wp-lightbox2 mashup) and I shall shortly be adding an overlay so that when viewing the thumbnails you can either bring up the lightbox or you can go through to the FAlbum page for that image.

In order to use the lightbox link to flickr you will be required to use my version of the wp-lightbox2 plugin but it should be fully compatible with the original wp-lightbox2 plugin so if you already use it you should be switch to mine without any problems.

I’m not going to release any files just yet as I want to get the overlay working first, I just thought you might like an update so you know things are progressing.

Previously posted:
FAlbum 0.6.5 Lightbox Mashup
FAlbum With Lightbox2
FAlbum AJAX Lightbox V2
FAlbum AJAX Lightbox

One response so far

May 17 2006

FAlbum 0.6.5 Lightbox Mashup

Published by under PHP,Programming,Software

I just noticed today that a new version of FAlbum was released on 6th May 2006. There has also been an upgrade of LightboxJs, taking it up to version 2.0.2.

I was in two minds as to whether or not to update my mashup but decided that as I want to upgrade my website I may as well release a new version of the mashup. Whilst I am still providing a download of both the diff files and the complete FAlbum plugin, I have made a change the mashup. Rather than including the LightboxJS scripts in the mashup I instead rely on the user have the WP LightboxJS script installed in their wordpress system.

I have taken this approach for the following reasons:

  1. So that users that already have the plugin installed don’t have to have two copies of LightboxJS in their blog.
  2. Users will be upgrade to future versions of the WP LightboxJS plugin without needing to upgrade their FAlbum plugin.

I have also decided to not include the WP LightboxJS plugin within my downloads so I do not wish to tie users to a particular version of the WP LightboxJS plugin, after all it’s easy enough to download and install it.

I am also hoping that I will be able to release a style for FAlbum that does the same as this mashup but without changing any of the core file of FAlbum… watch this space.

The installation instruction are included within README.Mashup.txt which is in the download files. You can download the 0.6.5 version files from my download page.

17 responses so far

Next »