Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

matbeard's avatar

MS SQL Server, IIS and PHP 7.2: 'Malformed UTF-8 characters'

I'm stuck with using SQL Server and IIS, and since upgrading to PHP 7.2, this problem has reared its ugly head again.

I've downloaded the appropriate Microsoft Drivers 5.2 for PHP for SQL Server and enabled them in PHP.ini, but now I'm getting the error: Malformed UTF-8 characters, possibly incorrectly encoded in line 75 of Illuminate\Http\JsonResponse.php

I initially had the same problem with PHP 7.0, but the Microsoft Drivers 4.1 for PHP for SQL Server were the soliution (version 4.3 resulted in the same error).

I guess the question is: has anyone successfully got Laravel working on IIS with SQL Server and PHP 7.2? If so, can you please explain how?

Thanks

0 likes
2 replies
matbeard's avatar

Thanks. I've seen all those links (with the exception of the last one), but they all suggest that the 5.2 version of the MS SQL drivers work with PHP 7.2.

Well, that's partly true: they do allow interaction with the SQL server. The issue is with Laravel's JsonResponse.php reporting malformed UTF-8.

In my experience, this is also a problem with version 4.3 of the MS SQL drivers, so it doesn't look like something that's going to be 'fixed' any time soon. Plus, it's not clear where the responsibility for fixing it lies: Laravel or the drivers (maybe neither)?

Please or to participate in this conversation.