Symfony: Prod environment on webserver produces blank page - symfony

my Symfony 3 app works flawless on my local webserver. Since it´s been installed on the remote web server it produces a blank page, even the routing doesn't work. After editing web/app.php $kernel = new AppKernel('prod', false); and set it to true, the application works as expected and does not display any errors.
Why does the application behave different on the local and the remote webserver. Did I miss to configure something on the remote server?
Any suggestions?
Thanks in advance!

Finally I have a solution to solve the problem: after the composer update I have to clear the cache of the prod environment manually by executing rm -fr var/cache/prod/*. For whatever reason does the command php bin/console cache:clear --env=prod quit working immediately after the composer update without throwing any error messages. After removing the cache files manually both the application and the cache:clear command work as expected without modifying web/app.php.

1.check permission to cache and log dirs ( need to be 777 )
2.check (paste here) error in logs/prod.log

Since I couldn´t find out what´s the real cause of this problem I´ve made a fresh install of my application and updated Symfony and all dependencies with composer.
Although I did the same with the old installation, it does the trick this time. My guess is, something went wrong with the composer update before.
Thanks again for your help! If someone has a similar problem I would appreciate if you could post how you solved the problem (or why AppKernel['prod'] = 'true' did work).

I have plausible explanation, what might have been the problem.
I have encountered this problem earlier this year with Symfony3, while developing on Windows but deploying manually (copying project's files) to shared server with Linux.
As you say - blank page in prod environment.
To add to the mystery log files did not show any problems
So i enabled dev environment to check what is wrong
application worked as intended if i added app_dev.php in the URL
I overviewed all the files, more than once, but copy was done correctly.
The answer
After some time I "came across" the file: bootstrap.php.cache in var directory. It "felt suspicious".
As I had exhausted my options i just deleted it to test the result.
That solved it in my case.
Site was running again.
No more blank page!
I guess mixed development environment has its toll.

Related

Drupal 8 error when trying to access any admin functionality

Any time I select an admin option i get the below error.
Error: Class 'Drupal\Core\Form\FormErrorHandler' not found in Drupal\Component\DependencyInjection\Container->createService() (line 258 of core\lib\Drupal\Component\DependencyInjection\Container.php).
I have cleared my cache and restarted wamp, not sure what the next step is.
If I get an error that is in a core or contributed module and clearing cache and and server restart doesn't help, I usually try running database updates next to see if any where missed.
Have you run the update.php? if that fails you could try using drush to run the update.php using drush updb
If that doesn't work I would run a backup of the codebase and db then try updating the modules, then update core using drush drush up
Restarted my PC and that seemed to work. I have no idea what the error is linked to, but that seems to work if anyone is having the same issue.

Meteor Environment - Blank and Everything Broken

I got to a point where Meteor seemed to just stop working, no HTML would load but the port was open, throwing basic console errors indicating that the most basic parts of the program weren't getting read.
After a lot of troubleshooting (clearing the database, restarting, logging out, using different ports), I just created a new Meteor project and copied and pasted my .html and .js files and the new project worked where the old project didn't.
So, question - how can I troubleshoot this in the future? Something was going on in the Meteor folder because the old and new files were exactly the same.
After a day, the error is happening all the time now and I can't create a single project. I tried uninstalling and reinstalling Meteor with no luck.
Also, the problem seems to be isolated to one port. I can open projects in other ports, but not in 3000.
Why is one port "breaking"? What can I do to fix this?
--Edit--
The HTML and CSS are loading, but in the default port 3000, the console reads
Uncaught ReferenceError: Package is not defined
It shows this code as the first error point:
/* Imports */
var Meteor = Package.meteor.Meteor;
Below is the Terminal:
--Edit--
So this is embarrassing, it seemed to be a cache problem. I cleared the cache, and I'm assuming it refreshed the .js files and now it works.
If anyone can answer why the errors were being thrown in the first place and how to fix besides creating an entirely new project, that would be hugely helpful!
please post your terminal so we have more clues to help you.
You definitely can run other ports, perhaps your port 3000 is used by another program.
Also, never run a meteor app as root.
Run meteor on a high port number. The default is 3000 when you don't give a --port argument. Connect to it via the URL printed in the console - e.g.
meteor --port 3001
http://localhost:3000/.
If you have settings.json then run meteor --settings settings.json

Velocity breaking meteor deploy

I am having trouble with my Meteor up, which is perfectly functional on localhost and on Modulus. When I try to deploy to a *.meteor.com instance the upload fails and I get a very cryptic error. The first line is the gist of it I guess
Error: not a tracked temp dir: /Users/valentin/.meteor/packages/velocity_core/.0.4.5.1dbi101++os.osx.x86_64+web.browser+web.cordova
I have tried installing and reinstalling velocity and tried deploying it with/without, the error persists. There are a bunch of hidden files in the folder the error points too. Deleting the one mention in the error simply creates new ones and throws an error again (naming a different folder though) Does anyone have an idea what it is about?
I had the same problem with another meteor package. It was solved after I delete everything from myapp/.meteor/local/ directory.
I think you can leave your local db there (myapp/.meteor/local/db), but I did not check if it still be working. (I've deleted all and probably it is the same as running meteor reset for your local project.)
OK, this seems to work: You have to manually downgrade the meteor version to 1.0.2.1, by editing .meteor/release and changing the version number. (There's a fix in dev, so it should be solved in a more complete fashion soon.)
Were you trying to deploy while your meteor app still ran in localhost? I faced the same problem for another package but resolved it by stopping my local meteor app first then deploy.

Monolog Couldn't find constant Monolog\Logger::DEBUGS

I keep getting an error with the MonologBundle for Symfony2:
Monolog\Logger::DEBUGS in /foo/vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php on line 119
It only happens in prod and happens only once, right after deleting the cache. After a refresh everything is back to normal.
All other answers suggest updating composer, which I have done, or deleting the bundle and monolog and reinstalling, which I have also done.
It happens both on my local machine (mac) and during deployment to my ubuntu machine using capistrano 2.x with capifony. Composer is freshly downloaded during those deploys, so composer version probably isn't the issue here.
Does anyone know how to solve this? Thanks in advance!
Most likely you have a typo in config, where you defined a log level for one of your handlers as "debugs" instead of "debug". Check your config.

How to debug 500 Error in Symfony 2 and above

I am struggling with Symfony 2 error reporting because I can't find out what really is happing when a 500 Error is triggered.
I have XDebug correctly installed, but it seems like Symfony rules everything.
The custom pages just says:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
That's pretty much funny! Something is broken, but, the fact is that I need to fix my code, but can't know what or where it is the problem! And sure, If I send an email for the Symfony team will they be able to solve my problem once I not even know what to say them?
Some clue on what I am missing here?
For Symfony 2 and below,
First, look at the logs in app/logs depending on your environment — dev.log for development, prod.log for production, etc.
If the code crashes before Symfony has a chance to run, check the logs of your web server — e.g. nginx.
If you have a symfony flex project, it is also possible that you forgot to install monolog ;) Run:
composer req log
For Symfony versions 3.x, 4.x, 5.x, 6.x and above,
The logs will be found depending on the environment
For dev env - var/logs/dev.log
For prod env- var/logs/prod.log
Also, as the accepted answer suggests, you might have to check the server logs if your app crashes before even reaching Symfony.
Usual location for server logs is listed below -
For apache server - ls /var/log/apache2
For Nginx server - ls /var/log/nginx
sudo chmod -R o+w var/cache/
from inside the project's folder,
solved the problem for me, at least this time :)
There were no errors in Symfony's or web server's logs.
What caused the problem
It turned out that the problem was caused by me previously removing the cache folder, and regenerating the cache, i.e.
rm -fr var/cache/
./bin/console cache:clear
After that, var/cache became drwxr-xr-x.
An even better way to improve your Symfony debugging process is to have Monit monitor your Symfony and Apache logs for any errors and send you emails whenever something bad happens: http://intelligentbee.com/blog/2016/01/12/how-to-monitor-symfony-and-apache-logs-with-mmonit/

Resources