I'm fairly new to UNIX, coming from a Windows background. I've created an instance on Amazon EC2 and installed apache, PHP and MySQl. i've successfully uploaded the files for a PHP website. Everything works well, except i have a problem sending mails from a contact form.
i went through the AWS tutorial here: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-using-smtp-php.html
i successfully installed composer and ran it in Putty and i see the vendor directory is created and the phpmailer files are downloaded.
site structure looks like this:
html
test_mail.php
--vendor
----bin
----composer
----phpmailer
----autoload.php
I've tried using the sample email script included in the tutorial which looks something like this :
// If necessary, modify the path in the require statement below to refer to the
// location of your Composer autoload.php file.
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
// Instantiate a new PHPMailer
$mail = new PHPMailer;
// Tell PHPMailer to use SMTP
$mail->isSMTP();
$mail->SMTPDebug = 2;
// Replace sender@example.com with your "From" address.
// This address must be verified with Amazon SES.
$mail->setFrom('sender@example.com', 'Sender Name');
but i get the following error:
Fatal error: Uncaught Error: Class 'PHPMailer\PHPMailer\PHPMailer' not found in /var/www/testSite/html/test_mail.php:10 Stack trace: #0 {main} thrown in /var/www/testSite/html/test_mail.php on line 10
line 10 is
$mail = new PHPMailer;
so i'm stumped as to what the problem is. The required PHPMailer files seem to have been created correctly by composer, and the path to 'vendor\autoload.php' should be correct.
is it possible there's something in the server setup I've missed?
any suggestions gratefully received.
David