Using the Gii Module of Yii1 in PHP 7.1

If you are using Yii1’s Gii Module and have upgraded to PHP 7+ you might be getting a 500 error message thrown at you when previewing Model diff code changes.

Methods with the same name as their class will not be constructors in a future version of PHP; Text_Diff has a deprecated constructor

I have recently upgraded PHP version for one of my projects. Speed improvement went was massive so it’s something that I would really recommend.

The application in question is still using Yii version 1. The good news is that the folk behind the Yii framework have release version 1.1.17 which makes it compatible with PHP 7+

Here below is my simple fix for the issue with the Gii Module. In the www/index.php file

if (strpos($_SERVER['REQUEST_URI'], '/gii/model/diff/id/') !== false) {
    ini_set('display_errors', 0);


UPDATE: on the 19th of April Yii has released Yii 1.1.18 which fixes various PHP 7 issues including the incompatibility bug in the Yii Module.

One thought on “Using the Gii Module of Yii1 in PHP 7.1

Leave a Reply

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