display blank page in production - symfony

Currently working on Symfony2, I'm trying to make my website work on a server on production environment.
But I get a blank page, it's OK on developpement environment.
Some things I saw :
No log file on app/logs
No specific error on Apache error log
With Firebug, I see a HTTP Error 500 for GET /web/.
Any ideas?

I've seen this happen if you use {{ dump(var) }} and the var has nested arrays. Try removing any dump, and if that does not work, tryign removing any variables you are using in twig to display a static page.
You may want to manually delete the prod cache and install assets again for prod mode. See Symfony Production Checklist for a list of basic steps with D and E covering the cache and assets.

Related

Handling 404/4xx/5xx errors in Symfony 4

I'm using Symfony 4.4.10 and I do have problem with correct error 4xx/5xx handling to get users to my custom html.
On production, when 500 error occurs, I'm getting this kind of screen:
Which is weird, because I followed this tutorial: https://symfony.com/doc/current/controller/error_pages.html
I have my templates overridden (like here), but still above screen occurs. (adding error500.html.twig file isn't changing anything)
When I'm debuging on dev it's ok, I mean, with this custom "_error" route.
What can be the problem here?
404 errors and sometimes work, sometimes not.
Regarding the documentation and your shared code, you are right.
Have you got clear cache dev and production environment ?
php bin/console cache:clear

401 unauthorized error access CSS files MVC

First things first, yes I am fully aware this has been addressed here before, however none of the solutions seem to resolve my issue. My problem is simply that I have created a new web project and everything works fine with the default code template that VS2013 has provided, the problem I am currently runing into is adding my own CSS files. This is the process I went through to add them:
added CSS folder under the already existing Content directory
Linked to CSS files in the header CSHTML (I can be sure it is linked properly as it is not a 404 error
but when i run the project i get: Status Code:401 Unauthorized (pulled form the network explorer in chrome dev tools), nothing more. I have tried everything from modifying my config file to setting WindowsAuthentication to true and even moving NTLM to the top, to going into IIS and giving everyone access to every possible function to the CSS directory, been at this for an hour and I'm simply lost, any ideas?
Edit: if it helps at all this is the erro i get when i navigate to one of the CSS files:
I found the issue and I feel incredibly stupid about it, as it turns out all of my css files had encryption set on, i simply had to turn it off: right-click
*.css file > Properties (General tab) > Advanced button > Encrypt contents to secure data checkbox.
Works like a dream. If anyone ever purchases a template form ThemeForest, be wary of that.

Symfony2: $_POST variables are empty on deployment

I'm currently working on symfony2 projects. Each time, the deployment process is a real pain in the back (even with the cookbook advices).
I have this strange feature that I can't explain. My post variables are always empty in some bundles of symfony 2, no matter how I access them ($_POST['foo'] or request->get('foo')). This feature is online only. On my local server, it works perfectly well.
Example 1: coresphere console bundle
I'm using the coresphere console bundle to run command line on my ovh remote server. But the bundle commands were never working (no matter what my installation was) ie my post variables were always empty causing each command to crash. I thought that may be an error in some of my other installed bundles was causing the post variables of the console bundle to be empty. So I installed it on an empty symfony2 project (I even removed Acme and of course I tested that everything was working on my local server before uploading the project). The console still didn't work. My only solution (a bad one though) was to hack the javascript console.js of the bundle and transform the post request into get request. It then worked fine. At this stage I thought: "ok may be the problem comes from ajax post request on ovh?"
Example2: A home made bundle for a project
I build a bundle for a project. In this project I don't use ajax post request at all. And still, my post variables are always empty (I remind that locally, everything works just smoothly). For this bundle I'm using FOSUserBundle with HWIOAuthBundle for authentication (if it has anything to do with that?)
Summary
I'm clueless about what is going on and I would like to have some sort of track to follow. Just as a reminder: I'm using an OVH shared server with the performance package. I can use git up there. But I can't really use console command (even in ssh). So that's why I'm using the coresphere console bundle.
Thank you for your help.
I got a solution for my home made bundle:
The problem was coming from my routing.yml file (in app/config). I was using fosjsrouting and it seems that the routing of fosjsrouting needs to be called at the very end of the routing.yml file (in app/config).
See below:
app/config/routing.yml:
... and at the very end:
fos_js_routing:
resource: "#FOSJsRoutingBundle/Resources/config/routing/routing.xml"
However, I still don't understand the problem with the coresphere bundle. This doesn't solve it.

Drupal - White Screen of Death after updates (and login page returning 403 error)

I have just updated a site that is using Drupal and have now experienced the horrible WSOD.
I have searched through Google looking for any sort of solution/error log to help me find and fix the issue but nothing has worked. I have tried adding in the 'display errors' code in the index.php file and looked at the error_log file in the public directory and nothing.
I can not login to the admin page and check any modules as the login page for this is returning a 403 error.
Any suggestions?
Please go to Apache Error log. You will exact error messages there.
The log file's location is different for different OS and versions.
e.g httpd/log/error.log
Maybe your Drupal registry is broken.
Fix this using the registry_rebuild script (this is no module!)
There are times in Drupal 7 when the registry gets hopelessly hosed and you need to rebuild the registry (a list of PHP classes and the files they go with). Sometimes, though, you can't do this regular cache-clear activity because some class is required when the system is trying to bootstrap.
You might get something like:
PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11
If this happens when you're trying to run update.php, and happens when you're trying to clear your cache, well, you have some trouble. That's what Registry Rebuild is for.
It also may happen that you've moved some module that Drupal requires to bootstrap, and you get a horrible error. Registry Rebuild will also rebuild the system table to get the modules in the right place so you can bootstrap.
You will need PHP-CLI or drush to run this.
https://drupal.org/project/registry_rebuild

I've overridden twig exceptions page but it only shows on dev pages, not prod

I've created custom error page:
app/Resources/TwigBundle/views/Exception/exception_full.html.twig
I've cleared cache but it still only appears on Dev pages. prod shows ugly "Oops! An Error Occurred" message which may or may not be a apache default page. Any ideas how to enable these custom error pages in prod environment too?
exception_full.html.twig is used only in dev environment.
In prod you have to use error.html.twig or error404.html.twig (this one is good when you want to customize specific error).
That is because more info needed to be shown in dev environment. In prod environment you wouldn't want to show all that info (logs, trace, etc.) that you are showing in dev environment. And that's why another template is used in prod.

Resources