Heroku | Fatal error due to PHP 7 and old version of CakePHP

|
| By Webner

Fatal Error on website whenever we were pushing any code change to our website hosted on heroku.

We were suddenly facing a fatal error (error 500) on our website. After making debugger on, it displayed the following error :
1

After exploring about it, we found that it was due to the version differences of PHP supported by our application framework (CakePHP). After checking about the supported versions on Heroku we came to know that heroku started using PHP 7 also but the cakephp version (2.5.2) which we were using does not support php 7.

To fix this error, change the supported php version value in “composer.lock” file as shown below :

Before :

"require": {
                "guzzle/guzzle": "~3.7",
                "php": ">=5.3.3"
            }

After :

"require": {
                "guzzle/guzzle": "~3.7",
                "php": "^5.6.0"
            }

The same thing is shown in the following screenshot :
2
After making this change in our project, the problem got solved. So, it means, if you want to support PHP 7 then you need to update your cakephp version to >= 2.8 or it will be better even to migrate to 3.x version of cakephp or you can continue with the current version of cakephp after making this slight change, it’s all up to you.

Leave a Reply

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