PHP 5 eAccelerator

This is a mini howto on installing eAccelerator.

eAccelerator is a free open-source PHP accelerator, optimizer, and dynamic content cache. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

Summary: Makes your PHP faster.

Continue reading “PHP 5 eAccelerator”

KB_CAPTCHA – CAPTCHA Image Generation in PHP

Introduction

KB_Captcha is a simple PHP script to generate reasonably safe CAPTCHA image to secure any public facing web application.

KB_Captcha offers the user a whole selection of options;

CAPTCHA Image Generation

I couldn’t find a very good CAPTCHA generation script in PHP, all the ones I looked at were ugly, over complicated or just rubbish! So I decided to write my own.

They may not be the most secure but at least they look decent!
I will progress this code over time to make the images and code more robush and secure. For now, it is just my ramblings scribbled down.

Continue reading “CAPTCHA Image Generation”

Converting XLS to CSV. Simple, eh? Well, sorta.

I hate problems that can be solved really easily. (With a totally different set of tools). I needed to open Excel (XLS) files in PHP. Simple enough you think, IF you are using Windows.

IF I was using Windows, I would have a bunch of options open to me, I could use PHP’s COM & .NET functions. Or PHP’s ODBC functions. Or a selection of classess from PHP Classes. Continue reading “Converting XLS to CSV. Simple, eh? Well, sorta.”

Yellow text?

I stumbled over a strange bug on two systems the other day where the imagettftext() function was always writing the text in yellow. No matter how I set the colour, imagecolorallocate($image, 0, 0, 0);, I would always get yellow. Why yellow?

Both systems are Ubuntu, I don’t know if it is a mix up on the libraries from the package, or indeed PHP.

I had to recompile PHP ignoring the –with-ttf option which most docs suggest, and just use the –with-freetype-dir instead. Problem solved.

“Mail option not available!”

I spotted a strange PHP “feature” in the error_log() feature.

PHP checks for sendmail functionality once during ./configure for the mail() and error_log() functions.

Now, you can quite happily pass the sendmail path with the ‘additional_parameters’ flag to the mail() function, if you added mail support later but error_log() won’t take that flag, so it fails with “Mail option not available!”

Rule: Install postfix/qmail/whatever BEFORE installing PHP if you want to use mail as an error_log() option.