johnro.net Now on AWS!

My WordPress site is now on AWS! I spent a good chunk of my time debugging the All-in-One WP Migration plugin to get my migration working, and I finally realized I skipped an important step in their migration documentation:

Migrate WordPress from PHP 5 to PHP 7

1. Make sure that all plugins are deactivated. This will ensure your website error is not caused by any third-party software

If you are getting stuck in the “Done Preparing Blogs” stage, then it could be because you didn’t deactivate all the plugins.

Cheers!

Homebrew PHP Upgrade: “configure: error: Cannot find libz”

I was routinely upgrading my packages on Homebrew when I ran into the following error:

Of course, I did the first thing I always do when running into an error, Google it! And I found this link that suggested running the following:

After that,

ran fine.

PHP: Connect to SQL Server Database on Linux (and Mac OS X)

Microsoft SQL Server
Microsoft SQL Server

I have used PHP to connect to SQL Server plenty of time, and every time I would use the SQLSRV extension. The problem with that is, PHP’s SQLSRV extension is only available for Windows servers. Which wasn’t a problem for me because I would normally develop PHP on Windows machines. It wasn’t until recently I needed SQL Server access on a Linux machine.

It wasn’t as straightforward as I had hoped, and it certainly did not help to learn that the MSSQL PHP extension was removed in version 7.0, which took me a few hours to discover. I am writing this post in hopes that I save some people a few hours of pain, including my future self.
Continue reading “PHP: Connect to SQL Server Database on Linux (and Mac OS X)”

PHP: How to array_merge Without Losing Numeric Keys

PHP function array_merge is nice in that you can easily merge one (or more) arrays into a single array with a single call of the function. The keys are retained, but only if they’re not numeric keys(!).

E.g.

Perhaps this is the behavior you want. But what if you want to retain the original numeric keys?

Continue reading “PHP: How to array_merge Without Losing Numeric Keys”

PHP: sqlsrv problems with UTF-8 values? Set your CharacterSet option!

Are you banging your head trying to figure out how to convert a seemingly invalid UTF-8 value into a valid one? You might be surprised to know that the problem isn’t how PHP interprets the characters, but rather a database connection issue. If the UTF-8 value in question looks valid in the database but does not look right when displayed on a web page, that could mean your database connection settings are not set correctly.
Continue reading “PHP: sqlsrv problems with UTF-8 values? Set your CharacterSet option!”