phpBB's Failed Sending Email Errors (and how to resolve)
2004-07-16 10:05
453 查看
Description: This article targets the "failed sending email" error on UNIX and people using PHP's mail() function (not phpBB's SMTP function) |
Author: dougk_ff7 |
Date: Thu Jan 29, 2004 4:15 am |
Type: Fix |
Keywords: email,sendmail,mail,unix |
Category: Installing/upgrading/converting |
Recently, I've been playing around with some stuff that uses mail() in PHP, and I know I've hit errors in the past when I've set phpBB to use the mail() function, and I never really figured out why each case was failing. It started when I got the real error from PHP (when another program called mail()) -- "PHP Fatal Error: Call to undefined function mail()" -- looking around for a bit, I found that there are a few things that can cause this. One is simply PHP can't find sendmail, so you need to point it in the right direction using the "sendmail_path" option in php.ini. If that fails to work, you're going to have to do a bit more work. Create a new .php file (for example, phpinfo.php), with only "<?php phpinfo() ?>" (without quotes) in it. Upload this to your server, and view it with your web browser. Look down a bit until you see "sendmail_path" -- I found if this is broken, it usually displays "-t -i" -- the default parameters it uses for sendmail, and nothing else. Ok, so that was kinda pointless. It doesn't tell us very much more. Anyway, now the real reason for creating the phpinfo() file. Please follow these steps *exactly* (or modify slightly for your setup, you'll get the idea): Copy that entire ./configure line up at the top of the phpinfo() page -- it'll make your life much less painful, trust me. Don't worry about the single quotes, they're fine. Just leave them. Check for a working sendmail -- postfix and most other MTAs should provide this, qmail will provide a compatible warpper. Just make sure there's something. /usr/lib/sendmail, /usr/bin/sendmail, and /usr/sbin/sendmail are good bets, as far as I know. If your sendmail is elsewhere, make a symlink back to /usr/sbin/sendmail ("ln -s /path/to/your/sendmail /usr/sbin/sendmail") -- for qmail, that's "ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail" Either grab the latest source of PHP, or find the source you built PHP from (this will require root later on, so if you're on a shared host, see if the problem exists outside of phpBB, and if it does, ask them to work on it for you). If you are using a clean source tree, skip this step. If not, run make clean. Run the ./configure line you just copied, or if you wish, reconfigure php to your liking. Hey, you're going to redo the entire thing, why not do it right? Run make, su to root, and make install. Check php.ini (if you don't know where it is, try "locate php.ini") -- make sure the sendmail_path is correct. Run apachectl stop, followed by apachectl start(ssl)? -- if you use ssl, use startssl, if not, just use start. I found that apachectl restart seems to have some strange quirks, and may just die on you after rebuilding PHP. If you can't find apachectl, try "locate apachectl" or "whereis apachectl" to help you out. Test mail() using a simple script. Unfortunately, I don't have one made. Perhaps php.net would have an idea? That's it. Hope this helps someone out there! Good luck! |
相关文章推荐
- php学习 面向对象 课件第1/2页
- php中计算时间差的几种方法
- PHP时间和日期函数详解
- PHP版本如何选择?应该使用哪个版本?
- PHP 线程安全与非线程安全版本的区别深入解析
- php gzip压缩输出的实现方法
- PHP扩展模块Pecl、Pear以及Perl的区别
- 在php和MySql中计算时间差的方法详解
- VC与Delphi之间动态链接库互相调用
- Microsoft Visual Studio .NET 2003制作安装程序
- javascript表单之间的数据传递!
- delphi中的时间操作技术(1)
- delphi中的时间操作技术(2)
- IP地址的隐藏(delphi实现 )
- 解析IP地址为主机域名
- 将某一主机域名解析为IP地址
- JCreator Pro 3.0与WTK2.0配置心得
- 非对称加密算法中求解大正整数模大正整数的余数的快速计算法