1

today, after a while, I decided to create a new Symfony2 project. I have composer installed at /usr/local/bin/composer and it is updated to its latest version:

$ composer self-update
You are already using composer version etc, etc...

Then I have typed the usual command:

composer create-project symfony/framework-standard-edition path/to/htdocs/PDFMonitor 

All went good:

...
Clearing the cache for the dev environment with debug true
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
The assets were installed using symbolic links.

Then I opened the browser and made a request to the symfony's config.php to be sure that actually everything was smooth, but I got this Major Problem error:

Symfony2 config.php

And this PHP notice and warning:

Notice: Undefined property: stdClass::$vendor-dir in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 751

Notice: Undefined property: stdClass::$vendor-dir in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 751

Warning: file_get_contents(/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php): failed to open stream: No such file or directory in /path/to/htdocs/PDFMonitor/app/SymfonyRequirements.php on line 546

I do not know why this is happening. I didn't use Symfony for a while, but I never had such a problem.

What I tried:

  • Run either composer install and composer update inside the project's root. Didn't help.
  • Reinstall composer curl -s https://getcomposer/installer | php and then:

    $ mv composer.phar /usr/local/bin

    $ rm -R /path/to/htdocs/PDFMonitor`

    and again:

    $ composer create-project symfony/framework-standard-edition path/to/htdocs/PDFMonitor

    Again the project is created but opening http://localhost/PDFMonitor/web/config.php gave the previous errors.

As I said I never experienced this problem before.

What should I do in order to make symfony work properly again? Why Symfony doesn't see the vendors?

tonix
  • 6,671
  • 13
  • 75
  • 136
  • Have you tried to go into root dir of symfony app and run `composer install` – Lord Zed Jan 02 '15 at 20:35
  • Yes I have done it without any effort as you can read from my question. I have just found that the issue is a bug of Symfony2.6 http://stackoverflow.com/questions/27744855/symfony-2-6-error-after-using-composer-vendor-libraries-must-be-installed#answer-27745261 But I still cannot get rid of these annoying error – tonix Jan 02 '15 at 20:45

1 Answers1

2

I found a solution to the problem: this is a bug in Symfony 2.6, actually 2.7 seem to have fixed it.

If someone still creates a project with composer create-project symfony/framework-standard-edition ..., where the Symfony2 version defaults to 2.6 and experiences the same problem I have faced, here is a workaround:

Either edit YourProject/app/SymfonyRequirements.php line 406 and

YourProject/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php line 406 and replace:

 is_dir($this->getComposerVendorDir()),

With this:

is_dir(__DIR__.'/../vendor/composer'),

This will remove the Major Problem complaining about the vendors. Then this will instead remove the file_get_contents() Warning:

Inside YourProject/app/SymfonyRequirements.php and make line 546 look like this:

file_get_contents(__FILE__) === file_get_contents(__DIR__.'/../vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php'),

Then open localhost/YourProject/web/config.php and you will see the nice Symfony Welcome page again.

enter image description here

tonix
  • 6,671
  • 13
  • 75
  • 136