ikleiman
ikleiman

Reputation: 545

Symfony2 Mixing Up Different environments

Today I ran into a very weird situation. I use several environments of my app for different purposes (the known ones: dev, qa, prod; and devftp that I use to save files via FTP and check changes online immediately, the other ones have SVN config).

The thing is for some reason the environments are getting mixed up, it happened to me before, but didn't gave it too much importance (one time I deleted an entity column and despite I have absolutely no reference to that column on the app I've got a ReflectionException error, I re-added the column without using it and some weeks after I've deleted it again without any problem). One error in particular is that in devftp I've declared a service and dev is telling me "Service Not Found". This is from nginx error log:

2012/09/07 06:33:16 [error] 3327#0: *9 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException' with message 'You have requested a non-existent service "aks.fs".' in XXXX/dev/app/bootstrap.php.cache:202
Stack trace:
#0 XXXX/devftp/src/AKS/XXBundle/AKSXXBundle.php(18): Symfony\Component\DependencyInjection\Container->get('aks.fs')
#1 XXXX/dev/app/bootstrap.php.cache(521): AKS\XXBundle\AKSXXBundle->boot()
#2 XXXX/dev/app/bootstrap.php.cache(548): Symfony\Component\HttpKernel\Kernel->boot()
#3 XXXX/dev/web/app.php(13): Symfony\Component\HttpKernel\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#4 {main}
  thrown in XXXX/dev/app/bootstrap.php.cache on line 202" while reading response header from upstream, client: XXXX, server: dev.XXXX.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "dev.XXXX.com"
"dev.XXXX.com.error.log" 509L, 72936C  

You can see how #1 on dev folder calls #0 on devftp folder. dev doesn't have a boot() method, devftp does and does calls aks.fs. Despite of that why dev environment that lives in dev folder is calling something from devftp folder?

This happened between qa and dev, and between qa and devftp too. (I've cleaned the cache (dev and prod) several times, both from CLI and deleting the entire folder). It's important to say that this happens only on prod env, using app_dev.php works perfect.

Any ideas?

Upvotes: 1

Views: 644

Answers (1)

Vitalii Zurian
Vitalii Zurian

Reputation: 17986

To me it looks like you use same APC key for all environments (you call them releases, but this is environment actually).

Try to set up different APC keys for your environments:

$loader = new ApcUniversalClassLoader('aks_dev');

or

$loader = new ApcUniversalClassLoader('aks_test');

or

$loader = new ApcUniversalClassLoader('aks_qa');

and so on.

Upvotes: 3

Related Questions