View Full Version : Fatal error: Call to undefined function: mail()
saeed
10-07-2003, 02:47 AM
Hi there
I can't send any mail using any PHP script.
Here is the error i get while trying to send a mail..
"PHP Fatal error: Call to undefined function: mail()"
This is only the problem with mail() all other functions are working fine.
Before that my sites was on another server and they were working fine.. yesterday i transferred my sites to a new server using direct admin. but now i m facing this problem... i dono wat's wrong..
where as i have checked phpinfo() stating as:-
sendmail_from = me@localhost.com
sendmail_path = -t -i
SMTP = localhost
smtp_port = 25
(same info as in php.ini)
please help me out in this regard.
DirectAdmin Support
10-07-2003, 02:20 PM
Hello,
That means /usr/sbin/sendmail didn't exist at the time of the php compile.
1) make sure exim is installed (and /usr/sbin/sendmail exists)
2) recompile php:cd /usr/local/directadmin/customapache
./build clean
./build php
John
John:
you said i need to do the following:
cd /usr/local/directadmin/customapache
./build clean
./build php
i tried that, but nothing changed
i still get the error
everything is working fine
only you say that i need to have the next file:
/usr/sbin/sendmail
but i only have: /usr/sbin/sendmail.exim
is that right ?
Fatal error: Call to undefined function: mail() in /home/user/domains/domain.com/public_html/index.php on line 3
mail("tim@domain.net","test","tim@domain.net");
DirectAdmin Support
10-08-2003, 12:35 PM
Hello,
If you don't have /usr/sbin/sendmail, type:ln -sf exim /usr/sbin/sendmailthen recompile php as stated above.
John
The Prohacker
10-08-2003, 01:56 PM
If that doesn't work.. To force compile PHP with the mail function..
cd /usr/local/directadmin/customapache/php-4.3.3
echo "#define HAVE_SENDMAIL 1" >> main/php_config.h
make
make install
after i recompiled PHP, IE wants to download all the php files
i checked the addtype's and the modules, everything is like:
<IfDefine HAVE_PHP?>
LoadModule php?_module modules/libphp?.so
</IfDefine>
where the ? reverse to the version.
i tried te disable the <ifddefine> etc etc , but nohting works
if i do in a shell:
<? echo 'test'; ?>
# php index.php
test
#
so php does work.... but not with apache, any idea ?
snickn
10-08-2003, 04:03 PM
I had this same problem, I have no idea what caused it....
saeed
10-09-2003, 12:49 AM
Thnx John...
Sorry for late reply as well. It has been fixed on the same day when you reply back the thread. Everything is working fine now. I did all the step you told about and it went all fine. :)
DirectAdmin Support
10-09-2003, 10:26 AM
Hello,
Remember that after compiling new modules, you have to restart apache in order to use them:service httpd restartIn some *rare* cases, there are apache modules where they shouldn't be (left over from previous installs), and apache ends up using a different modules directory, and ignoring everything you do. The proper location is /usr/lib/apache, so if you find some elsewhere, just delete the other directory and try it again.
John
outpernet
10-14-2003, 06:29 AM
that happened to me too. i think per default that function, mail(), is disable (it shouldn't).
DirectAdmin Support
10-14-2003, 10:26 AM
Hello,
As mentioned above, the only reason that function won't be included in php is if the file /usr/sbin/sendmail didn't exist beforehand. I've just changed the customapache script to create the link, even if there was an error when installing exim. This will ensure that php will have mail() included. Then if exim wasn't installed, it can be fixed later without having to recompile php.
John
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.