Shawn Northrop
Shawn Northrop

Reputation: 6016

Error with Symfony installation

I created a new Symfony project using composer:

composer create-project symfony/framework-standard-edition ./

After vendor downloads and the parameter.ini file questions I get the following error:

PHP Parse error: parse error, expecting')'' in /Users/..../app/cache/dev/appDevDebugProjectContainer.php on line 20`

I inspected the file

class appDevDebugProjectContainer extends Container
{
    private static $parameters = array(
        'kernel.root_dir' => dirname(dirname(__DIR__)),     //LINE 20
        'kernel.environment' => 'dev',

I don't see why this is causing an error but removed the dirname(dirname(__DIR__)) and I hardcoded the absolute path.

I tried to run ./app/console and got another error within the appDevDebug file, another reference to __DIR__.

I was able to get through a few of these by hardcoding the path but eventually got to a different error message altogether (still within the appDevDebug file).

This file is autogenerated so I decided to stop going down that path... Any idea what would be causing this?

I have run php app/check.php and it says my system is configured to run symfony. I also have older installs of symfony (2.4, 2.5) on the same machine and they run fine.

Upvotes: 1

Views: 224

Answers (2)

greg
greg

Reputation: 1927

I had to change composer.json:

"require": {
    ...
    "symfony/symfony": "2.6",
...

Previously it used dev branch

"symfony/symfony": "2.6.x-dev",

After that change it went smoothly.

UPDATE

Actually you might have to use service.xml not service.yml. For some reason service.yml does not work for me (it is ignored).

Upvotes: 1

spekulatius
spekulatius

Reputation: 1499

I'm researching the same issue and found those solutions so far:

Have you set your timezone for the CLI php.ini ? You can check with this:

php --info | grep timezone

Alternatively you can clear the cache and try again:

rm -Rf app/cache/dev (prod instead of dev for a productive environment)

Upvotes: 0

Related Questions