I’m trying to run
PHPMailer on my server, but I’m having trouble getting PHP webpages to find it.
If I run
php -f send_mail.php, it runs just fine, but when I curl
example.myserver.com/send_mail.php, I get the following error:
Warning: require(PHPMailer/src/Exception.php): failed to open stream: No such file or directory in /var/www/html/send_mail.php on line 10 Fatal error: require(): Failed opening required 'PHPMailer/src/Exception.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/send_mail.php on line 10
I note in the above error that the include path looks to be
'.:/usr/share/pear:/usr/share/php', even though in
/etc/php.ini, I have the line
include_path = ".:/usr/share/pear:/usr/share/php:/php/includes". I also ran
phpinfo() to verify that
/etc/php.ini was being read by the interpreter, and all seems fine there.
In any case, the
PHPMailer folder is in the
include_path quoted in the error, so it should be seeing it anyway.
(me@server ~)$ ls /usr/share/php/PHPMailer/ changelog.md composer.json examples language phpdoc.dist.xml SECURITY.md test UPGRADING.md COMMITMENT docs get_oauth_token.php LICENSE README.md src travis.phpunit.xml.dist VERSION
Any ideas what I might be missing to get
PHPMailer visible to my PHP webpages?
EDIT: I’ve also seen this question already, but the problem here seems to be related to a leading backslash in the path given to
require, which isn’t my issue.