Archive For The “PHP” Category

PHP is_numeric() vs is_int()

Some lessons you don’t forget, but this one I did because it doesn’t come up very often. Don’t use is_int() because, as Jeremy says, it’ll lie to you. Use is_numeric() instead. Copy the following chunk of code into a php file and run it. You’ll be surprised at the outcome: $t = “12345″; if( is_int($t [...]

Read more »

No activity within 1800 seconds; please log in again

1800 seconds is such a long time, right? It’s 30 minutes. It’s 0.5 hours. It’s 0.0208333333 days. It’s also 5.70397764 × 10-5 years. And it’s not long enough for me. phpMyAdmin logs you out after 1800 seconds, obviously for security reasons. That’s fine if there are other people about, if I was in an office [...]

Read more »

Is your eAccelerator cache dir still there?

While looking through this WordPress performance post I realised that eAccelerator might not be running properly on this blog. For some time I’ve noticed this site hasn’t been as quick off the mark as it used to be. Dare I say it, but it was even a little sluggish! If you’re not familiar with it, [...]

Read more »

Notes when upgrading to PHP5

I upgraded one of my servers to PHP5 this morning. Two things to watch out for: The location of your php.ini may have changed. It’s probably now in /etc/php5/apache2/. You need to copy over any changes from your old one. Update your libraries too such as the mysql client and the gd library. Don’t forget [...]

Read more »

Cannot load mysql extension. Please check your PHP configuration.

A friend recently had a problem configuring a new server. He installed PHP, Apache, MySQL and phpMyAdmin but when he launched it he got the following error: phpMyAdmin – Error Cannot load mysql extension. Please check your PHP configuration. If you’ve installed all of the above more than once you’ll know what is more than [...]

Read more »

Killing off PHP

Do you know why Apache processes get stuck and stop responding when serving pages on a WordPress site? I’ve seen this happen here and on my previous host on a regular basis. I don’t know what happens. It can’t be a PHP script gone into an infinite loop because the normal Apache timeout should kill [...]

Read more »

Gzip Compression or No?

mod_gzip, zlib.output_compression or whatever way you compress your web pages is a great way of reducing your network traffic costs but comes at the cost of increased CPU usage. Despite what you might think, it can be more expensive to send data over the network, especially to slow clients than compress it first of all [...]

Read more »

Five common PHP design patterns

Over at IBM Developer Works there's an interesting article on PHP patterns. If you've never come across patterns before it's a good introduction. Just remember that these methods of solving software problems are most useful when you've got lots of code. Using the MVC pattern to print "Hello World!" is probably a little overkill! For [...]

Read more »

PHP Optimization and Security tips and rant

Andrew van der Stock’s criticism of PHP’s security model. What security? Global request arrays go some way to making applications safer but there are obscure functions and settings which can trip up developers. (via) PHP Optimization Tricks from Ilia Alshanetsky has one gem I didn’t know about – the ctype extension. It’s somewhat limited but [...]

Read more »

Writing Scalable Applications with PHP

Linux Journal’s Writing Scalable Applications with PHP article makes a bold claim which some of the comments on it disagree with. Must follow some of the links later.

Read more »



Holy Shmoly! is Stephen Fry proof thanks to caching by WP Super Cache