Category: php

Can not set cookie in symfony app. How to fix it?

It can’t set cookie on my PC. I am working with my brother and it works for him on his PC if (isset($_POST[“stay_logged”])) { setcookie(“user_code”, $user->getCode(), null, “/”); $this->session->set(“user_code”, $user->getCode()); } isset($_POST[“stay_logged”]) return true, “stay_logged” is name of checkbox. sign_in.html.twig…

Why is my Symfony 5 local server showing the HTTP request as text instead of a rendered page?

I just wanted to try out Symfony 5 for my own education, so I followed the instructions here. symfony check:requirements shows that I have the requirements needed to run the application (I’m running Windows 10 with php 7.3.4 running via…

How to show custom 500 error page in production only in symfony?

I created a custom 500 error page by overriding the default 500 page. I did this by creating exception.html.twig template in templates/bundles/TwigBundle/Exception/exception.html.twig. But the problem is that it shows this template in all environments when a 500 error occurs. How…

Controller can’t find repository method

I’m trying to use data from my database. There is my Controller ChemineesRepository.php : /** * @return Query */ public function findAllVisibleQuery(): Query { return $this->findVisibleQuery() ->getQuery(); } and then there is my Controller ChemineesController.php : /** * @Route(“/cheminees/authentiques”, name=”authentique”)…