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 linux server to run them from. Currently proud of; Mags Direct - a site I created for my work at the Frontline Group. An online magazine shop, which I created with almost zero budget within a week (since had a full theme upgrade). Found at https://magsdirect.co.uk/ Married, one cat. Beer fanatic (wife probably says bore) - real ales and craft beers. I have spent for too much on home brew gear, I create full mash craft beers. I spend a lot of time either going to gigs or organising them - I'm part of a small bunch of friends putting on DIY Punk shows called "The Scary Clown Presents..." our website can be found here; https://thescaryclownpresents.co.uk/ 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 *