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 likely wrong. The MySQL PHP module isn’t loaded. First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the phpinfo(); command it will tell you where it is. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini

Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!


should become

InnoDB: Starting shutdown…

Calling all MySQL admins! When you’re working with InnoDB tables you may have noticed that MySQL takes an extraordinary amount of time to shutdown. Don’t panic! It’s normal.
InnoDB has extensive logs that it must run through and if your server is at all busy these logs can be quite big.
After you’ve started the equivalent of “/etc/init.d/mysql stop” it may not return for quite a while. Simply open another terminal and examine the system log. On a Debian or Ubuntu box, look at /var/log/daemon.log and you’ll see the “InnoDB: Starting shutdown…” message.
Now, go off and make a cup of tea because this could take a while. On a fairly large and busy database it might be half an hour or more!
Please, please, please don’t be tempted to killall -9 mysqld because bad things will happen! Even if your boss is looking over your shoulder, and you’ve promised that the company webserver will be online in 2 minutes, don’t do it.
However, cases where it is ok to kill the database with a “kill -9”:

  • International terrorists are planning on robbing the World Bank and you’re the only secret agent who can bring down the database which will stop them.
  • Lassie will be run over by the evil farmer who plagued the local village with his monster cows unless you can corrupt his database in time.
  • Or finally, you like hard work and restoring from backups!

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 would be faster and less resouce intensive than a regular expression to do simple checks.

While I’m blogging development stuff, here’s mention of a vector drawing library in Javascript!
Yes, newer browsers have SVG support but this will work in older browsers and newer. Cute.

2 for the developers

2 links for the developers around here:

  • Quick Lookup is an online dictionary of PHP,MySQL, Javascript and CSS commands and keywords. As of this moment, “55% ish of MySQL is done, JS is NOT finished yet” but it’s still useful if you haven’t got the PHP manual handy.
  • Regular Expression Checker – regexes are an arcane science. Everyone needs all the help they can get when working with them! (via)

Later.. Here’s another AJAX powered regular expression checker via Matt.

SQL Injection Attacks by Example

Ever wondered how some of your favourite apps get hacked and broken into? This page lists lots of examples of database “injections”.
Like an injection you get off your doctor these bits of code inject database code into your application. The code can do anything – delete all your data, grab your passwords, or anything.

And if it happens to you, a nice doctor isn’t going to give you a lollipop.

How to Use Design Patterns

How to Use Design Patterns

Among developers, design patterns are a popular way to think about design, but what is the proper way to think about design patterns? In this interview, Erich Gamma, co-author of the landmark book, Design Patterns, talks with Bill Venners about the right way to think about and use design patterns.

Ignore details early on

Oh, this is so true!

We’re crazy about the details. We love the details. The space between objects. The perfect type leading. The perfect color. The perfect words. 4 lines of code instead of 7. The perfect flow. 90% vs 89%. 760px vs 750px. $39/month vs. $49/month. Success and satisfaction is in the details.

However, success isn’t the only thing you’ll find in the details. You’ll also find fixation, stagnation, disagreement, meetings, and delays. These poison projects. These are the things that kill morale (and if morale is low, your chance of success is even lower). You want to avoid these at all costs. If you procrastinate, procrastinate the details.

Testing the Developer

Usability testing can be daunting and goes overlooked in the rush to get things out the door, but it’s important, if somewhat hard on the egos of developers when their super-duper ideas are torn down and trodden on!
See the great comic too! hehe.