Class not found error only on production server

I am working on a project using Silex. In a specific file, I added a use statement so that the autoloader includes a specific php file. Later in the file I use this class. Everything is fine on the development server, but when I switch to production, I get the message Fatal error: Class not found . Edit: PHP 5.4.4 is now used on both servers.

Are there any installation problems that might be causing this? I can confirm that both autoload namespace files created by the 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 have to add that I have not seen such errors anywhere in a rather large code base that I am working on, so I know that it is not as simple as all namespaces do not work.

+6
source share
2 answers

By default, Mac uses a file system with verified registrations. Linux, depending on your taste, is mostly case sensitive. This will certainly lead to the behavior described above.

I would advise you to create a second partition on your Mac and format it as it was checked for compliance with Case magazine closer to your work environment.

+5
source

Thanks for the comments. I made sure that I updated the use of Composer so that the autoloader was reset.

The problem (as I learned after frequent classes) was that the directory structure for the third-party library that I used (Instaphp) was lowercase. This did not give my Mac a problem, but Ubuntu is running on the production server, which I suppose uses case-sensitive file-processing utilities where the Mac does not work.

I totally kick myself for spending the night on it!

+4
source

Source: https://habr.com/ru/post/925803/


All Articles