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 of course!)

	$exts = get_loaded_extensions();

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

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.

	// Configuration.
	$url = ''; // Replace with whichever URL.
	// Open the connection.
	$handle = @fopen($url.'?=PHPE9568F36-D428-11d2-A769-00AA001ACF42', 'r');
		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!