2

I deployed a symfony 3.4 project from my local machine (Windows 10) to a cloud server (Digital Ocean) based on Ubuntu.

I spent 2 days trying to resolve this (i think) routing problem:

"request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader..."

Locally, on localhost with XAMPP, it works perfect.

The project runs ok on the login (is like a backend user app), with the register ok But when it tries to pass the login, it needs to load the initial dashboard with some includes (like nav_side.html.twig) and the server response is error 500.

How can i fix it?

Thanks a lot for your response...i'm a little bit desperate. :)

I made composer update, i deleted the cache folder, but the error is still there.

request.CRITICAL: Uncaught PHP Exception Twig_Error_Loader: "Unable to find template "Backe ndBundle:includes:nav_side.html.twig" (looked into: /var/www/onecup/app/Resources/views, /var/www/onecup/vendor/s
ymfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in "BackendBundle:Dashboard:index.html.twig" at line 7." at /var/www/onecup/vendor/twig/twig/lib/Twig/Loader/Filesystem.php line 234 {"exception":"[object] (Twig_Err or_Loader(code: 0): Unable to find template \"BackendBundle:includes:nav_side.html.twig\" (looked into: /var/www/ onecup/app/Resources/views, /var/www/onecup/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form) in \"BackendBundle:Dashboard:index.html.twig\" at line 7. at /var/www/onecup/vendor/twig/twig/lib/Twig/Loader/Fil
esystem.php:234)"} []

DarkBee
  • 16,592
  • 6
  • 46
  • 58
Mauricio
  • 41
  • 1
  • 4
  • Hi Mauricio, have you configured the corresponding server file to read from the public folder? have you deleted the .env or .env.local file and repositioned its variables in the previous configuration file? – M. Galardi Jan 05 '19 at 19:41
  • Strange that is worked in development but not production. Go ahead and verify that [this answer](https://stackoverflow.com/questions/47832977/symfony-3-4-use-view-inside-my-bundle/47835716#47835716) is not relevant. And of course verify that your views/includes directory got uploaded. Also verify the file name case is correct since Windows is case insensitive. And the space in "Backe ndBundle seems a bit suspicious though I assume it is a copy/paste sort of thing. – Cerad Jan 05 '19 at 19:58
  • Doing "composer update" in production is a bit dangerous. You should be uploading the composer.lock file from your development machine and using "composer install" to ensure you get identical versions of third party software. Plus make sure the php versions match. – Cerad Jan 05 '19 at 20:01
  • @Mauricio examine your code and try to find possible case inconsistences in directory / filenames. e.g. "file" and "File". Windows filesystem is case-insensitive, but Ubuntu filesystem is case-sensitive – Flying Jan 05 '19 at 20:54
  • its not able to find nav_side.html.twig, try BackendBundle:includes\nav_side.html.twig – Giray Kefelioglu Jan 05 '19 at 21:23
  • Thanks a lot for all the responses. I'll take the time to see all your differents options to fix this. @Cerad Thanks for that info. – Mauricio Jan 06 '19 at 00:41
  • Could you provide full path to `nav_side.html.twig`? What is your `twig.yml` look like? How does your controller with `$this->render('nav_side.html.twig')` look like? You migh want to delegate template paths [to autoloading](https://github.com/Symplify/Symplify/blob/master/packages/Autodiscovery/README.md#2-twig-paths) to skip these issues – Tomas Votruba Jan 06 '19 at 14:52
  • @M.Galardi i don't have a .env file, in localhost from my machine neither. The login (first page) is working ok (and save the data to the mysql database). I've never saw an env file. Is it necessary on a repo clone on a cloud system? – Mauricio Jan 07 '19 at 12:51
  • Is your directory named `includes` or `Includes` (note the case)? Your local filesystem may be case-insensitive while the one on the server isn't. – xabbuh Jan 07 '19 at 15:16
  • Sorry Mauricio, I went from Symfony 2 (it does not have the .env file) to Symfony 4 (it has it). – M. Galardi Jan 07 '19 at 15:24

1 Answers1

2

@Flying was right: examine your code and try to find possible case inconsistences in directory / filenames. e.g. "file" and "File". Windows filesystem is case-insensitive, but Ubuntu filesystem is case-sensitive.

So, i changed the Includes to includes and that's all.

Thanks a lot!! :)

Mauricio
  • 41
  • 1
  • 4