Yii2 shows White Screen Error on production

Tags: , ,

Recently I’m facing some issues when I deploy my code to live server. It returns me white screen error. When I tried to debug the issues using the below code,


Shows me an Parse error “Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /var/www/html/project/vendor/symfony/polyfill-php80/bootstrap.php on line 23“.

But the same code is working perfectly on local apache server. For production I am using AWS EC2 Ubuntu instance.

While researching on the issue, I came to know that most of it happens due to php version change, but in my case my local and production have almost same version and it is php 7 (Screenshot attached).

PHP Version of Production.

PHP Version Production.

PHP Version of Local.

PHP version Development

Can anyone suggest me any tips to overcome this situation.


This error is classic proof that your server is in fact not running PHP 7+ because error indicates that typed method (function) returns are not supported. You can see for yourself here.

The versions you are showing on screens are from console where PHP can be in totally different version from the web one. The easiest way of checking the web PHP version is running this script through browser:



And look for PHP version in output.

Source: stackoverflow