1

Is anyone aware of a bug of PHP 5.1.6 causing:
Fatal error: Call to undefined function mail() ?

I have the same code running smoothly in PHP 5.2.0 but on this server with PHP 5.1.6 it is nondeterministic whether the mail function is defined or not. I am sure the problem is not in the code itself because simply running this script:

// PHP 5.1.6
<?php 
if (function_exists('mail')){
    print 'mail is defined';
}
else{
    print 'mail is undefined';
}
?>

... php prints sometimes "mail is defined" and sometimes "mail is undefined".

Colin 't Hart
  • 7,372
  • 3
  • 28
  • 51
Matteo
  • 37
  • 1
  • 2
  • 1
    check your mail function via phpinfo() some hosting companies can disable mail function if your hosting company disabled mail function you can check this URL [link](http://stackoverflow.com/questions/112190/php-ini-smtp-how-do-you-pass-username-password) – Mustafa May 13 '11 at 19:43
  • Do you get both "defined" and "undefined" from the same server? In that case you might want to ask your hosting provider to fix the problems and install PHP with mail() support. – Arjan May 13 '11 at 20:53
  • yes, I get defined and undefined randomly just refreshing a page containing only this script. mail looks correctly compiled and enabled in phpinfo(). I think I will ask rackspace (my hosting company) if they can fix it. – Matteo May 13 '11 at 21:53
  • 7
    5.1.x is _far_ out of date. – KingCrunch May 14 '11 at 00:07
  • Regarding PHP 5.1.5, someone posted a [similar report](http://bugs.php.net/bug.php?id=38611). Unfortunately, the maintainer qualified it as a non-bug. Did you compile PHP yourself? Or do you use a standard build of a linux distribution? – SteAp May 13 '11 at 19:43
  • Your hosting company must be using a reverse proxy against a farm of webservers, some properly configured with the mail function and some not (and all of them sharing data via a NFS mount or similar) – Toni Rosa Sep 24 '13 at 20:40

0 Answers0