Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]PHP Symfony Mailer, Błąd 500
Codeleft
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 21.03.2021

Ostrzeżenie: (0%)
-----


Cześć wszystkim,

w Symfony zainstalowałem mailera zgodnie z dokumentacją symfony:
https://symfony.com/doc/current/mailer.html

- Dane do logowania SMTP trzymam w .env

no i cały problem polega na tym, że na localu wszystko ładnie działa a na hoście tylko jeden z trzech controllerów działa dobrze a dwa pozostałe nie - błąd 500.
Kod jest napisany w każdym kontrolerze podobnie, sprawdziłem i nie ma żadnych literówek etc.

Moje pytanie to: Gdzie szukać przyczyny błędu.[php][/php]
Go to the top of the page
+Quote Post
viking
post
Post #2





Grupa: Zarejestrowani
Postów: 6 380
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


W logach jeśli je masz.
Go to the top of the page
+Quote Post
Codeleft
post
Post #3





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 21.03.2021

Ostrzeżenie: (0%)
-----


"Uncaught PHP Exception RuntimeException: "Controller "App\Controller\ShipperController::main()" requires that you provide a value for the "$mailer" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one." .../vendor/symfony/http-kernel/Controller/ArgumentResolver.php line 80"

Przekazuje:

  1. public function main(ReCaptchaKeys $ReCaptchaKeys, EntityManagerInterface $entityManager, Request $request, MailerInterface $mailer): Response

Interface jako argument funkcji main przy czy dokładnie to samo robię w kontrolerze który działa. (IMG:style_emoticons/default/ohno-smiley.gif) (IMG:style_emoticons/default/ohno-smiley.gif)


ps.
Wszystko działa na hoście w przypadku ustawień w env.
APP_ENV=local



Ten post edytował Codeleft 12.02.2022, 15:18:09
Go to the top of the page
+Quote Post
viking
post
Post #4





Grupa: Zarejestrowani
Postów: 6 380
Pomógł: 1116
Dołączył: 30.08.2006

Ostrzeżenie: (0%)
-----


Ponieważ dość tajemniczo nie mówisz co to za framework to jedyne co można zgadywać to że service manager nie potrafi poprawnie utworzyć instancji.

Z dokumentacji symfony
//config/packages/mailer.php
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->extension('framework', [
'mailer' => [
'dsn' => '%env(MAILER_DSN)%',
],
]);
};

Ten post edytował viking 12.02.2022, 16:03:06
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 02:11