Get server operating system in PHP

Posted by & filed under Programming.

This function returns ‘win’ if running on a Windows server and ‘linux’ if not running on a Windows server. It should be pretty easy to extend it to match other server operating systems, but this is all I needed.

is_safe_mode function for PHP

Posted by & filed under Programming.

The following function will return TRUE if the server is running PHP in safe mode. It uses the function ini_get, which may be disabled. If ini_get is disabled then the function also returns TRUE since the assumption that any server disabling functions would probably also be running in safe mode.

Get ImageMagick version with PHP

Posted by & filed under Programming.

Knowing what version of ImageMagick is usually important if you’re going to be shelling to it to perform tasks. For me it was the –sepia-tone option that was added in either 6.2.1 or 6.2.2. Prior to that, using that option caused the conversion to fail. The following function will return the numeric version of ImageMagick… Read more »

SEO company sending me spam

Posted by & filed under Internet, Programming.

You know, I’ve pretty well accepted that I’m going to have email spam get through to my inbox. Even with Thunderbird’s spam filtering, it still gets through. But today I got a spam message from an SEO company called The Search Doctors and it just hit the wrong nerve.

Blocking AdSense ads on your own site

Posted by & filed under Internet, Programming.

One of the fears of AdSense users is that they will accidentally click on an ad on their own site and get banned by Google. I’ve always assumed that these fears are a little over-hyped. I just can’t see one accidental click causing you to get dropped. Of course you certainly don’t want to make… Read more »

file_get_contents function for PHP 4

Posted by & filed under Programming.

One of the functions added in PHP 5 is file_get_contents. This function allows you to just pass a file name and it will return the entire contents of the file. That’s all well and good if you’re using PHP5, but PHP4 is still very common.

ProofBuddy Software

Posted by & filed under Photography, Programming.

I’ve been working on an application for the past several months and it’s now at a point where I feel comfortable releasing it. ProofBuddy is a PHP / MySQL application that allows professional photographers to show proofs to their clients. It has an integrated shopping cart so that your clients can order their prints directly… Read more »

GoDaddy and disabled PHP functions

Posted by & filed under Internet, Programming.

During a support issue with a user of one of my web applications I made a fairly important discovery about and how they have PHP installed on their servers. Many functions – 44 last time I looked – are disabled. Now, this may just be with their economy package and they have them enabled… Read more »

PHP function – directory_size()

Posted by & filed under Programming.

Here’s a quick PHP function that will return the size of all files in a directory. To use: pass the directory you want to check as the only variable, eg: directory_size(“/home/web/directory”)