PHP Fyrwerks

I am pleased to announce that I am in the process of developing and (at some stage) releasing my personal PHP development framework – Fyrwerks. This has been an ongoing project for some time, it is only recently that I have decided to consider releasing it publicly.

While I can’t give away too many details just yet, the following are some of the features you can expect to see in the first release:

  • A structured framework for installing and maintaining custom PHP web apps.
  • Libraries dedicated to simplifying and object orientating repetitive or complex tasks
  • Fast script execution and reliable communication channels between different services.
  • Compact and easy to set-up.
  • Fully GoPHP5 compliant.

The development site is located at http://fyrwerks.com, some early demos should be available from next month.

Check back soon for updates!

//-plasm!d-//

Partial RAR extraction using WinRAR

WinRAR allows users to split file archives into smaller pieces (a feature present in most major archiving software these days). It is sometimes the case that one or more of these pieces are missing, and as such the archive cannot be completely reassembled. This tutorial shows how to partially recover files from a RAR that does not have all pieces present.
Continue reading Partial RAR extraction using WinRAR

Portable Google Chrome Beta

READ: THE DOWNLOAD LINK IS AT THE END OF THE POST!

For your web browsing pleasure, I present to you a portable version of the Google Chrome BETA.

Notes/Instructions

  • It is a single executable.
  • The program will run from USB stick / external media.
  • The default cache and user settings path is still accessed by the program (usually root:documents and settingsYOUR_USERNAMElocal settingsapplication datagoogle … )
  • The actual installer only came out a few hours ago, I haven’t really tested this portabilisation further than making sure all the basics seem to work (although I can’t think of any reason why there would be any problems!). If, however, you do encounter issues while using it — leave a comment on this post.

Download

The file is being hosted off-site, CLICK HERE TO DOWNLOAD. If you are having any problems downloading the RAR package, please leave a comment on this post and I will arrange an alternative download solution. Happy browsing 🙂

Google Chrome BETA – A first glance

Like many Googleholics around the World, today I was pleased to discover that Google have released their new Chrome browser. Not heard of it? Try taking a look at the bottom of your Google search page and you’ll see what I’m talking about:

Google Chrome Browser Beta 1

However! Before you rush off to download and install the latest combatant to enter the browser wars, you might want to have a look at my first glance review!

Continue reading Google Chrome BETA – A first glance

September Update

Wow! September already? Anyway, onwards and … er, upwards as they say!
Over the coming months I will be installing my development site in place of this blog. I know this is going to be a nuisance, but I feel the time has come to have a proper site portal and sandbox for my projects.

The blog will still be accessible (at a URL to be announced, probably just /blog.) and incoming links will be fixed up to reflect this change in location.

Wishing everyone a happy and productive September! 🙂

//-plasm!d-//

List PHP extensions with functions

This is a quickie I thought I’d put up on my break. Although it isn’t exactly complex or ground-breaking, its nice to have it at hand if you wanted to see which extensions provide particular functions (without having to refer to php.net of course!)

	$exts = get_loaded_extensions();

	foreach($exts as $ext) {
		$flist[$ext] = get_extension_funcs($ext);
	}
	
	print_r($flist);

This is a nice starting point if you wanted to write a script that determines whether the server you’re installing onto has the necessary PHP extensions loaded.

PHP GUID Exposure

There’s a neat little tutorial on how to access various PHP easteregg images at 0php. The author also describes how to prevent your server from displaying this image (to prevent outside users from being able to determine whether or not your server is running PHP).

I thought I’d make a little script that takes advantage of this easteregg and the inherent format of GIF image files to determine whether PHP is running on a remote server.

<?php
	
	// Configuration.
	$url = 'http://www.example.com/'; // Replace with whichever URL.
	
	// Open the connection.
	$handle = @fopen($url.'?=PHPE9568F36-D428-11d2-A769-00AA001ACF42', 'r');
	if($handle)
		echo("Handle active...
n"); else die("Error creating handle!n"); // Import data into buffer. $buffer = fgets($handle, 4); if($buffer == 'GIF') // <- part of the binary header for GIF files. echo("This server is using PHP!
n"); else echo("This server is NOT using PHP!
n"); // Close up, clean up. $ret = fclose($handle); $handle = NULL; if($ret) echo('Success!'); else die('Failed to close handle!'); ?>

Don’t forget to replace $url with the server address before using this script.

Has no interwebs? Oh noes!

Yup, I’m without home internet for a whole 2 weeks (it’s scary how much you miss it when it’s gone!). Since I can only get online to write on this blog at work, my posting consistency is probably going to be quite bad 🙂

I’ve still got a fair few draft posts to sort out and go through properly. In the mean time, as a boredom breaker – try out Doukutsu, it’s immense!

PHP 5.2.x __toString() Support

Since updating to PHP version 5.2.2 (which has been superseded yet again since this post) the default behavior of class objects is to raise an error when cast to a string (usually a ‘Catchable Fatal Error’, citing that the object could not be converted to string!).

This is quite irritating, as previously the default behavior would be to return a unique object identifier. However, there is a quick workaround for this problem should your script rely upon object string casting / this unique object identifier.

The Fix

When creating your class, add in __toString() as a function. This so-called ‘magic function‘ is called when trying to cast an object to string, such as (string) $someObject. The following combines this function with a call to spl_object_hash(), which provides an identifier hash for the object:

<?php

class SomeClass {
	function __toString() {
		return spl_object_hash($this);
	}
}

$someObject = new SomeClass;
echo $someObject;

?>

The above code is fairly self-explanatory and it saves you from at least a few of minutes banging your head on the table 🙂

Glancing normality

My recent absence and unfulfilled promise of geeky goodness has not been entirely in vain! For the past month or so I’ve been wrapped up in academic pursuits – ranging from preparing cell cultures to programming with Cell microprocessors!

As a result, I have a rather large backlog of draft posts that I haven’t had the time (read: been bothered) to complete. This week marks the beginning of my Big Blog Catchup – starting with some bits and pieces about running Fedora Core 7 on a Sony PlayStation 3!