User Created Image
User Created Image

Reputation: 1182

Symfony 2, autoload.php generated in wrong directory

I'm using symfony 2 and trying to run composer install --ignore-platform-reqs

It worked before, but now on a fresh setup I'm getting an error require_once(app/autoload.php): failed to open stream: No such file or directory

Full error below:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap

Warning: require_once(app/autoload.php): failed to open stream: No such file or directory in /Users/macbook/www/myproject/source/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 29

Fatal error: require_once(): Failed opening required 'app/autoload.php' (include_path='.:') in /Users/macbook/www/myproject/source/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php on line 29
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception


  [RuntimeException]                                     
  An error occurred when generating the bootstrap file.  

The problem is that it worked before. So it looks like app/autoload.php was always in the correct place. Now I'm doing fresh install and it is not there.

I was able to find autoload.php in vendors/autoload.php but not sure why it located in the wrong place.

My composer.json:

{
    "name": "symfony/framework-standard-edition",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.1.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.0.*",
        "twig/extensions": "1.0.*@dev",
        "symfony/assetic-bundle": "2.1.*",
        "symfony/swiftmailer-bundle": "2.1.*",
        "symfony/monolog-bundle": "2.1.*",
        "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*",
        "kriswallsmith/assetic": "1.1.*@dev",
        "doctrine/mongodb-odm-bundle": "3.0.*",
        "snc/redis-bundle": "2.1.*@dev",
        "doctrine/doctrine-fixtures-bundle": "dev-master",
        "incenteev/composer-parameter-handler": "~2.0"
    },
    "minimum-stability": "dev",
    "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "update-parameters": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ]
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "env-map": {
                "mongodb_server": "MONGODB_SERVER"

            }
        }
    }
}

Upvotes: 0

Views: 1325

Answers (1)

Gander
Gander

Reputation: 2001

After installation, composer runs a script from this file: ScriptHandler.php, which gets the path for config key symfony-app-dir and calls the next script from the file: build_bootstrap.php

If you do not have an autoload.php file, you probably need to copy it from the autoload.php.dist file

Upvotes: 1

Related Questions