Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception.php — 'No such file or directory', although there is one. #2883

Closed
homespunphilosopher opened this issue Mar 13, 2023 · 1 comment

Comments

@homespunphilosopher
Copy link

homespunphilosopher commented Mar 13, 2023

Problem description

My comments in [].

Warning: require(/PHPMailer/src/Exception.php): Failed to open stream: No such file or directory in /Library/WebServer/Documents/sites/cognitorum/sendPHPMailer.php on line 7 — [in fact, there is one for Exeption.php]

Fatal error: Uncaught Error: Failed opening required '/PHPMailer/src/Exception.php' (include_path='.:/opt/homebrew/Cellar/php/8.2.3/share/php/pear') — [the path is correct, although in fact it starts from '/'] — in /Library/WebServer/Documents/sites/cognitorum/sendPHPMailer.php:7 Stack trace: #0 {main} thrown in /Library/WebServer/Documents/sites/cognitorum/sendPHPMailer.php on line 7

Code to reproduce

// Load PHPMailer

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require '/PHPMailer/src/Exception.php';
require '/PHPMailer/src/PHPMailer.php';
require '/PHPMailer/src/SMTP.php';

Debug output

@Synchro
Copy link
Member

Synchro commented Mar 13, 2023

You're using absolute paths when they should be relative. Try removing the leading / from them to start with. This would also be a good time to learn how to use composer.

@Synchro Synchro closed this as completed Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants