I have a problem with setting up PHPMailer. It was working before, but now all of a sudden it stopped and this is the error I'm getting:
PHP Fatal error: require(): Failed opening required '../src/PHPMailer.php' (include_path='.:/opt/cpanel/ea-php53/root/usr/share/pear:/opt/cpanel/ea-php53/root/usr/share/php') in /home/pandatra/site.com/contacts_form/contact_form.php on line 9
Here is the code in contact_form.php:
<?php
include 'config.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
require ''.$d['include_path'].'PHPMailer/src/Exception.php';
require ''.$d['include_path'].'PHPMailer/src/PHPMailer.php';
require ''.$d['include_path'].'PHPMailer/src/SMTP.php';
$mail = new PHPMailer(true);
if (isset($_POST['Send'])) {
How to fix this? Any ideas? I downloaded version 6.1.7 of PHPMailer.
The error you mentioned is that, the path in your require is getting Wrong. To avoid this type of problem , you should always use absolute path
e.g.
require __DIR__.'/PHPMailer/src/Exception.php';
require __DIR__.'/PHPMailer/src/PHPMailer.php';
require __DIR__.'/PHPMailer/src/SMTP.php';
# use "use" after include or require
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\SMTP;
__DIR__ is the absolute path of running file's directory.