Erorr 500 when submitting form after AWS Elastic Beanstalk deployment

29 Views Asked by At

I am trying to deploy a website with a php form on AWS. Each time I go to submit the form I get an error 500. It it is showing the instance is running. I also checked the logs and did not see anything wrong with it.

<?php

$name = $_POST["name"];
$email = $_POST["email"];
$message = $_POST["message"];

require "vendor/autoload.php";

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;

$mail = new PHPMailer(true);


$mail-> SMTPDebug = SMTP::DEBUG_SERVER;

$mail ->isSMTP();
$mail->SMTPAuth = true;

$mail->Host = 'smtp.gmail.com';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
$mail->Port = 587;

$mail->Username = "USERNME";
$mail->Password = "PASSWORD";

$mail->setFrom($email, $name);
$mail->addAddress("****@ellejs.com", "NAME LASTNAME");

$mail->Subject = "{$name} Cleaning Request";
$mail->Body = "Name: $name\nEmail: $email\nMessage: $message";

$mail->send();

header("Location: sentmail.html");

?>

*everything in capital letters is just a replacement

I tried rebooting the environment, adding the correct IAM roles to the instance.

0

There are 0 best solutions below