Class not found error only on production server

namespaces, php, silex

Solution

By default, Mac's use a Journaled Case-Insensitive Filesystem. Linux, depending on your flavor, mostly is case-sensitive. This will definitely result in the behavior you described above.

I would suggest you create a second partition on your Mac and format it as Journaled Case-Sensitive to it matches closer to your production environment.

Problem

I'm working on a project using Silex. In a particular file, I've added a `use` statement to have the autoloader include a particular php file. Later in the file, I use that class. All is well on the development server, but when I move to production, I get a `Fatal error: Class not found` message. Edit: Both servers now use PHP 5.4.4. Are there any kind of installation specific issues that might be causing this? I can confirm that both namespace autoload files generated by composer are the same. Just for the sake of thoroughness, here is the include statement: ``` use Instaphp; ``` Here is the use of the class later in the code: ``` $app['instaphp'] = $app->share(function() use ($app) { if($app['tagframe.instagram_token'] === null) { return Instaphp\Instaphp::Instance(); } else { return Instaphp\Instaphp::Instance($app['tagframe.instagram_token']); } }); $app['instaphp.config'] = $app->share(function() use ($app) { return Instaphp\Config::Instance(); }); ``` Here is the exact error: ``` Fatal error: Class 'Instaphp\Config' not found in /var/www/silexsandbox/src/TagFrame/Silex/TagFrameServiceProvider.php on line 89 ``` Update: I should add that I have experienced no such errors anywhere else in the fairly large code base I'm working on, so I know it's not as simple as ALL namespaces not working.

Original source