PHPMailer error on windows server 2019 with php and mysql
Budget: $10 – $30 USD
I am looking for someone who can help me resolve an error I am getting using PHPMailer on a Windows Server 2019 machine with php and mysql installed.
I am getting the following error:
PHP Warning: require(): open_basedir restriction in effect. File(C:\php\lib\PHPMailer-main\src\PHPMailer.php) is not within the allowed path(s): (c:\inetpub\wwwroot;c:\windows\temp\) in C:\inetpub\wwwroot\pa-do.php on line 10
PHP Warning: require(C:\php\lib\PHPMailer-main\src\PHPMailer.php): Failed to open stream: Operation not permitted in C:\inetpub\wwwroot\pa-do.php on line 10
PHP Fatal error: Uncaught Error: Failed opening required 'C:\php\lib\PHPMailer-main\src\PHPMailer.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\pa-do.php:10
Stack trace:
#0 {main}
thrown in C:\inetpub\wwwroot\pa-do.php on line 10
Line 10 is this line:
require 'C:\php\lib\PHPMailer-main\src\PHPMailer.php';
The php program in question has these lines at the top:
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
// use PHPMailer\PHPMailer\PHPMailer;
// use PHPMailer\PHPMailer\Exception;
require 'C:\php\lib\PHPMailer-main\src\PHPMailer.php';
require 'C:\php\lib\PHPMailer-main\src\SMTP.php';
require 'C:\php\lib\PHPMailer-main\src\Exception.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
This is a simple program to send a message. But it is the first time I try this on this machine. I have little experience with PHPMailer.
Can someone tell me what is causing this error and provide me with the solution.
This is an easy thing to fix if you know PHPMailer, php and Windows.
I am getting the following error:
PHP Warning: require(): open_basedir restriction in effect. File(C:\php\lib\PHPMailer-main\src\PHPMailer.php) is not within the allowed path(s): (c:\inetpub\wwwroot;c:\windows\temp\) in C:\inetpub\wwwroot\pa-do.php on line 10
PHP Warning: require(C:\php\lib\PHPMailer-main\src\PHPMailer.php): Failed to open stream: Operation not permitted in C:\inetpub\wwwroot\pa-do.php on line 10
PHP Fatal error: Uncaught Error: Failed opening required 'C:\php\lib\PHPMailer-main\src\PHPMailer.php' (include_path='.;C:\php\pear') in C:\inetpub\wwwroot\pa-do.php:10
Stack trace:
#0 {main}
thrown in C:\inetpub\wwwroot\pa-do.php on line 10
Line 10 is this line:
require 'C:\php\lib\PHPMailer-main\src\PHPMailer.php';
The php program in question has these lines at the top:
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
// use PHPMailer\PHPMailer\PHPMailer;
// use PHPMailer\PHPMailer\Exception;
require 'C:\php\lib\PHPMailer-main\src\PHPMailer.php';
require 'C:\php\lib\PHPMailer-main\src\SMTP.php';
require 'C:\php\lib\PHPMailer-main\src\Exception.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
This is a simple program to send a message. But it is the first time I try this on this machine. I have little experience with PHPMailer.
Can someone tell me what is causing this error and provide me with the solution.
This is an easy thing to fix if you know PHPMailer, php and Windows.