require_once and require
Am using PHPMail.
If I use require 'PHPMailer/PHPMailerAutoload.php'; or require('PHPMailer/PHPMailerAutoload.php');
I get this error msg: fatal error PHPMailer class not found
But if I use require_once('PHPMailer/class.phpmailer.php');
it works fine.
Also the strange thing is require 'PHPMailer/PHPMailerAutoload.php'; or require('PHPMailer/PHPMailerAutoload.php');
works fine on my testing site.
Can anyone shed some light here?
Thanks in advance.
Either that file does not exist where you are trying to require it but failing, or you (probably actually the web server user account) don't have read permissions on it, or the directory structure is different so it's not in the same location relative to where it's being called from.
Thanks for your reply. Agreed if the user account doesn't have read permission then how come require_once works fine?
At first read, I thought you were saying that the require[_once]() statements were failing, but upon a closer look it appears some other statement that depends on the PHPMailer class having already been defined is failing. Therefore it would seem that something is different between the two environments and/or code bases, as in the test environment you already had the PHPMailer class definition loaded when it was needed, but not in the other environment. Why that would be is impossible to say without diving into the code, whether or not you have an __autoload() function defined incorrectly, or different include_path settings, etc.