<?php // comment out the following two lines when deployed to production defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require(__DIR__ . '/../vendor/autoload.php'); require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); (new yii\web\Application($config))->run(); 

Parse error: syntax error, T_OBJECT_OPERATOR in Z: \ domains \ utverdil \ 1484627257_account_u0270056_u0270056_16.01.2017 \ u0270056 \ data \ www \ utverdil.ru \ index.php on line 12.

Where is the mistake? I just can not understand. 12 line is the last.

  • one
    the norms there are open-source backups for you) - tCode

3 answers 3

 (new yii\web\Application($config))->run(); 

Your version of php does not allow such expressions.

Update php, or
Break the line into 2:

 $app = new yii\web\Application($config); $app->run(); 

or we used a global function in one project on php5.3 (choose the name yourself):

 function f($a) {return $a;} 

Then you can:

 f(new yii\web\Application($config))->run(); 
  • such a question, what if I do it on a local hosting? How to specify the version? - Dev
  • What does it mean to indicate? You need to install the correct version. You can see it either in cli: php --version or in the browser to watch the output of the phpinfo() function - vp_arth

You are using yii2 .

Yii2 requires PHP 5.4 or higher. And you, apparently, PHP 5.3 or lower.

The proposed answers, where you are offered to change the call ->run() will not help, because in Yii2 PHP 5.4 syntax is used everywhere. Even if you correct the call in this line, errors will appear in other places.

You need to upgrade the PHP version on your computer. How to do this depends on which package you used to install the web server on your computer.

    In php earlier than version 5.4 You must first create an object

     $test = new yii\web\Application($config); $test->run()