I have apache in this dir C:\Program Files\Apache Software Foundation\Apache2.2\
and
Mail.php and PEAR.php are in this dir C:\php\PEAR\pear
When I add the files to the dir the log file is complaining about below, the wiki spits out the following:

Could not send confirmation mail.  Check address for invalid characters.
Mailer returned: Unable to find class for driver smtp

Error from apache log file before files are moved from php dir

[Fri Apr 20 17:21:17 2007] [error] [client 0.0.0.0] PHP Warning:  require_once(Mail.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\wiki\\includes\\UserMailer.php on line 87, referer: [url]
[Fri Apr 20 17:21:17 2007] [error] [client 0.0.0.0] PHP Fatal error:  require_once() [<a href=' function.require'>function.require</a>]: Failed opening required 'Mail.php' (include_path='C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\wiki;C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\wiki/includes;C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\wiki/languages;C:/PHP/PEAR;.;C:\\php5\\pear') in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\wiki\\includes\\UserMailer.php on line 87, referer: [url]

Thanks, sj

Dani AI

Generated

Good catch — the problem turned out not to be UserMailer.php but PHP not being able to find PEAR's Mail class, so MediaWiki couldn't load the SMTP driver. 's fix (adding the PEAR directory to MediaWiki's search/include path) is the right approach; copying PEAR files into the webroot is unnecessary and can cause confusion. 's encouragement was well placed.

Quick checklist and troubleshooting steps that usually resolve this class-not-found / driver-not-found situation:

  • Confirm the PEAR Mail package and its dependencies are installed (Mail, Net_SMTP, Auth). On a machine with pear available run pear list and, if needed, pear install Mail Net_SMTP Auth.
  • Verify which php.ini Apache is using and what include_path it exposes. Create a small phpinfo page and open it in the browser; check "Loaded Configuration File" and "include_path". Either add the PEAR directory to php.ini's include_path or add it from LocalSettings.php (preferred over moving files).
  • On Windows use forward slashes (for example C:/php/pear) or escape backslashes in PHP strings so paths aren’t accidentally treated as escape sequences. Restart Apache after any config change and watch the PHP/Apache error log for new messages.
  • If using SMTP with TLS/SSL, enable the openssl extension in php.ini and use the proper port (typically 587 for TLS).

Typical LocalSettings.php SMTP example (adjust values for your server):

$wgSMTP = array(
  'host'     => 'smtp.example.com',
  'IDHost'   => 'example.com',
  'port'     => 587,
  'auth'     => true,
  'username' => 'user@example.com',
  'password' => 'yourpassword'
);

Final notes: keep LocalSettings.php permissions tight so SMTP credentials aren’t world-readable, and if problems persist paste the PHP error-log lines (not just the user-facing mailer message) — they almost always point to the missing include path or a missing PEAR package.

Recommended Answers

All 2 Replies

good work

good work

Thanks whizz..

Finally got this working. The issues had nothing to do with UserMailer.php.

I Needed to make some changes in LocalSettings.php in my wiki dir. Mainly adding the path to pear in the line below:
$path = array( $IP, "$IP/includes", "$IP/languages", "C:\PHP\PEAR\pear");

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.