Search code examples
phpyii2appserver

Warning: Unexpected character in input: '\' (ASCII=92) state=0


I got following error for my php code that integrated yii framework.

Warning: Unexpected character in input: '\' (ASCII=92) state=0 in C:\AppServ\www\edusec\index.php on line 15

Parse error: syntax error, unexpected T_STRING in C:\AppServ\www\edusec\index.php on line 15

code:

    <?php
    if(!file_exists(__DIR__.'/config/db.php')) {
        header('Location: edusec-requirements.php');
        die;
    }

// comment out the following two lines when deployed to production
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'prod');

require(__DIR__ . '/vendor/autoload.php');
require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php');

$config = require(__DIR__ . '/config/web.php');
$app = new yii\web\Application($config);
$app->run();

I'm working on Windows 7 with Appserv 2.6.0 (Php 6).


Solution

  • Quoting from the Wiki here on StackOverflow

    PHP 6

    On July, 30th, 2014 a majority of the PHP steering group decided to skip version 6 to avoid confusion with an earlier but abandoned PHP 6 project (dubbed the Unicode release). While there never was any official release of PHP 6, many books and articles had been published already.

    PHP 6 Does not exist, and never will officially exist. It was completely deleted from the version control repository.

    The fact that AppServ still provides access to AppServ 2.6.0 show a complete lack of responsibility on their part.

    The latest official version of PHP is 5.6.13, use that official release. The next major release (around November 2015) will be PHP 7.... there will be no PHP 6