I have a server ruing on apache2 with some virtual hosts and I want to deploy a Symfony3 application on it. However, I caot deploy it correctly to the production environment, it works perfectly on development environment. Whenever I do execute
sudo composer install --no-dev --optimize-autoloader
I get the error: PHP Fatal error: Class 'SensioBundleGeneratorBundleSensioGeneratorBundle' not found in /var/www/test.karljohnchow.com/drone-api/drone_api/app/AppKeel.php on line 25 Script SensioBundleDistributionBundleComposerScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command: PHP Fatal error: Class 'SensioBundleGeneratorBundleSensioGeneratorBundle'not found in /my/path/app/AppKeel.php on line 25.
After getting this error I went to read the documentation again and it said that I need to export this the Symfony environment to production. So I did that:
export SYMFONY_ENV=prod
After that I executed the composer install command again but, same results.
Some people on Stackoverflow (and other sources) said that I need to clear my cache by executing
sudo bin/console cache:clear --env=prod
So I did that but same results. Anyone any idea?
Other sulutions tried: Actually it works great whenever I execute the command this way:
sudo SYMFONY_ENV=prod composer install --no-dev --optimize-autoloader
However, whenever everything was installed correctly, I went to try to visit the URL and I got a 500. So I went to the Apache2 logs to check if something was wrong and I saw the same RuntimeException again.
