symfony2: class loading/namespace handling - difference between prod/dev environments? <p>what's exactly the difference in class autoloading and namespace handling between symfony2's app_dev.php and app.php or dev/prod environment (symfony 2.8.4).</p> <p>When I run it in dev environment through app_dev.php all is fine, when I run it in prod through app.php I get an Internal Server error 500 (nothing written in symfony's prod.log). Looking into apache's error.log I see:</p> <pre><code>PHP Fatal error: Class 'SSMCRM\\Common\\ProductionTemplateMapper' not found in /var/[...] </code></pre> <p>And yes, I cleared the prod cache...</p> <p>app.php: <pre><code>use Symfony\Component\HttpFoundation\Request; /** * @var Composer\Autoload\ClassLoader */ $loader = require __DIR__.'/../app/autoload.php'; include_once __DIR__.'/../app/bootstrap.php.cache'; // Enable APC for autoloading to improve performance. // You should change the ApcClassLoader first argument to a unique prefix // in order to prevent cache key conflicts with other applications // also using APC. /* $apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader); $loader-&gt;unregister(); $apcLoader-&gt;register(true); */ //require_once __DIR__.'/../app/AppCache.php'; $kernel = new AppKernel('prod', false); $kernel-&gt;loadClassCache(); //$kernel = new AppCache($kernel); // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter //Request::enableHttpMethodParameterOverride(); $request = Request::createFromGlobals(); $response = $kernel-&gt;handle($request); $response-&gt;send(); $kernel-&gt;terminate($request, $response); </code></pre> <p>app_dev.php:</p> <pre><code>&lt;?php use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Debug\Debug; // If you don't want to setup permissions the proper way, just uncomment the following PHP line // read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup // for more information //umask(0000); // This check prevents access to debug front controllers that are deployed by accident to production servers. // Feel free to remove this, extend it, or make something more sophisticated. if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '192.168.33.1', //for vagrant box )) || php_sapi_name() === 'cli-server') ) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.'); } /** * @var Composer\Autoload\ClassLoader $loader */ $loader = require __DIR__.'/../app/autoload.php'; Debug::enable(); $kernel = new AppKernel('dev', true); $kernel-&gt;loadClassCache(); $request = Request::createFromGlobals(); $response = $kernel-&gt;handle($request); $response-&gt;send(); $kernel-&gt;terminate($request, $response); </code></pre> <p>in the autoload.php I added our legacy classes to the loader:</p> <pre><code>$loader-&gt;add('SSMCRM', __DIR__.'/../web/legacy/classes'); </code></pre>