I have a customer who has a slew of Joomla websites. These are all older Joomla sites that are limping along with a short life expectancy while their replacements are being built by the customer. The sites had been hosted on various cPanel servers of mine of the years, from the days of PHP 5.2 and MySQL 4.1 all the way up to now, with CloudLinux and MariaDB 10. Each site has been migrated/transferred to another server multiple times over its lifetime, always to another server running a newer version of MySQL.
Fast Forward. The customer now has a dedicated server of their own running CloudLinux, cPanel and MariaDB. The customer wanted these sites migrated to their server, and of course I was on board with that.
I started migrating these sites only to find that after migration many of them were displaying strange characters in place of apostrophes and other “normal” characters. Obviously some sort of character set / encoding issue. This really baffled me, and I spent many days investigating the cause and testing different theories and changing configurations to get these sites to display properly. At no time did I feel that modifying Joomla code or standard Apache / PHP configurations was the answer, since these sites survived numerous migrations in the past without issue. PHP settings were exactly the same. SQL character sets, character encoding and collation were all the same. The databases themselves were unchanged from the dump/import done during the cPanel transfer process.
On Sunday I decided to switch from PHP 5.3 from CloudLinux’s PHP selector to “native” PHP 5.5 compiled through EasyApache 3. Lo and behold, the sites worked fine. Ok, I was on top something, but didn’t know what yet. I brought up some phpinfo data from a site when running native PHP and compared it to phpinfo from a site when running PHP Selector. After doing a stare-and-compare until my eyes were crossed, I finally realized one thing different about the two phpinfo results.
When running native PHP 5.4, the Client API versions for mysql, mysqli and pdo_mysql PHP modules showed as mysqlnd 5.0.10 – 20111026, but when running Alt-PHP PHP 5.3 from PHP Selector the API versions showed as 10.0.24-MariaDB. Ahah, now we’re getting somewhere. My thought that there was something fouled up with the MariaDB specific drivers shipped with CloudLinux’s Alt-PHP, such as them possibly using different collation or something. I opened up a ticket with CloudLinux. I had some nice back and forth exchanges with support persons at CL, each time trying something different. Of course, as mentioned before, I was adamant that I wasn’t going to be changing code or character sets in PHP/Apache or converting databases from one character set or another.
After about an hour of troubleshooting, one of the CL guys suggested that I disable the mysql, mysqli and pdo-mysql modules and enable the nd_mysql, nd_mysqli and nd_pdo_mysql drivers. Much to my surprise, that resolved my issue. And now phpinfo when running Alt-PHP PHP 5.3 also showed the Client API version as mysqlnd 5.0.8-dev – 20102224.
(Historically all of my machines are set with mysql, mysqli and pdo_mysql modules enabled in PHP Selector)
So, for these specific sites I am using nd_mysql, nd_mysqli and nd_pdo_mysql modules instead of mysql, mysqli and pdo_mysql.
Obviously the reason why I never had an issue migrating before is because I was always migrating from one MySQL server to another, never to a MariaDB server.
It’s important to say that I’ve migrated 100s of sites (WordPress sites mainly) to Cloudlinux/cPanel servers running MariaDB and never had an issue. This only cropped up when I was migrating these ancient Joomla 1.5.x sites, and only when migrating to a Cloudlinux/cPanel server running MariaDB.
I appreciate the support of the Cloudlinux crew. I still don’t know if its a bug in the MariaDB drivers shipped with Alt-PHP or if the behavior is by design.