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.
11-13-2013, 12:41 PM
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.
11-14-2013, 12:57 AM
Thanks for your reply. Agreed if the user account doesn't have read permission then how come require_once works fine?
11-14-2013, 01:54 AM
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.