Depreciated MySQL Connects with XAMPP and WordPress

0

Depreciated MySQL Connects with XAMPP and WordPress

Warning; If Doing PHP Development With WordPress locally, you can run into issues if you install PHP version 5.5.x onwards.

UPDATE: Since WordPress 3.9, PHP 5.5 and the MySQLi functions are now properly supported, so this article will no longer be relevant.

xamppThis, as I’ve just found, is because from PHP v5.5.x onwards, the MySQL* commands are depreciated.   It’s also good practice to show ALL errors when developing PHP locally, and I’m not 100% sure, but I think v.5.5.x of PHP forces stops and makes you read depreciated errors anyway…

I found this out as I downloaded the very latest XAMPP PHP & Apache package from www.apachefriends.org. as I’d read that it’s a pretty good stack for doing your development locally on Windows.  That 1.8.3 package installed PHP 5.5.x, which I thought all well and good.  But when I then set-up a virtual domain and copied in the WordPress files and tried to run the ‘5 minute install’, all I saw was PHP error stacks.

I did some Google investigations, and it turns out that the dev team behind WordPress have been using the basic MySQL connect stuff since the dawn of time.  Zend/PHP.net do tell you that you should have ported over to the ‘better’ MySQLI API’s, or use the Object PDO version.

“It is not recommended to use the old mysql extension for new development, as it has been deprecated as of PHP 5.5.0 and will be removed in the future”

But the team behind the WordPress core will not be looking to change over to one of the other methods until at least version 3.8 (we are only ‘just’ on version 3.6.. so we are some months away yet, possibly a year or more at time of writing).

So the only thing to do was to un-install XAMPP 1.8.3 and go with the 1.8.2 version, which uses PHP 5.4.x instead.  It’s not a fantastic move, but I want to get on and NEVER TOUCH THE CORE CODE IN WORDPRESS.  That’s the number one rule of WordPress development!

So away I go again – hopefully I’ll get a clean WordPress installation running locally (I have MANY remotely as you can see in my portfolio page).  Then I can start to tinker with things – writing my own custom theme, and/or new plugins.  I’m reading up on the ‘WordPress Loop’, and the WordPress API – I have a new book “Professional WordPress: Design and Development“, and another waiting.. in fact then a Pro PHP book.. and a MySQL admin/development guide… and a few more.    I’m starting soon as Development Lead at New Scientist, so am brushing up… and want some books to put on my new desk 🙂

 

Author: Krispy

Webmaster of this and many websites over the years. I've been a Senior developer (Java JEE and Oracle DB, specialising in SEAM/JSF/Hibernate web development). Ex Lead Developer at New Scientist magazine, where I worked on creating a new WordPress based website, using almost 100% custom created widgets, plugins and theme. My own projects include websites created in WordPress and custom written with PHP and MySQL, and have my own dedicated Windows server to run them from. Currently proud of; My several darts websites; http://www.pdc-darts.co.uk - Darts, Beers & Cheers, and http://www.opendartstournaments.co.uk/ - Darts Open Tournament database. I also run websites for over ten of the elite players on the PDC tour, and two for darts management companies. Married, one cat. Beer fanatic (wife probably says bore) - I'm becoming an expert in real ale, craft ales, and Belgium and German beers. If expert means enjoying them. I've also dabbling in doing a bit of extract home brew. CAMRA member, and now regular guest judge for the local Beer festival. I've even created the 'semi official' web app for the Peterborough Beer festival (2nd largest in the country). Play a little darts (badly for Stilton), and watch .. LOTS of darts. Also a fan of the local footy team - UP THE POSH!

Share This Post On

3 Comments

  1. Rubbish! actually just testing something

    Author name

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *