php – 在XAMPP for Linux中使用mailtodisk / mailoutput

Windows不同,我在Linux中使用“mailtodisk”PHP选项时遇到了麻烦.看起来它甚至不存在.

在“PHP.ini”中,在邮件部分中,没有对它的引用:

[mail function]
; For Win32 only.
; http://PHP.net/smtp
SMTP=localhost
; http://PHP.net/smtp-port
smtp_port=25

; For Win32 only.
; http://PHP.net/sendmail-from
;sendmail_from = me@example.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://PHP.net/sendmail-path
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On

; Log all mail() calls including the full path of the script, line #, to address and headers
mail.log ="/opt/lampp/logs/PHP_mail_log"

[sql]

我无法在localhost主页中看到“Mail”链接,用于测试邮件表单,因为它有很多崩溃,如下所示:

注意:未定义的变量:第12行的/opt/lampp/htdocs/xampp/start.PHP中的TEXT

Obs:尽管localhost主页有这个错误,但我正在运行没有问题的项目.

事实上,它似乎没有菜单中的“邮件链接(我搜索了源代码).

我不知道这些信息是否有任何帮助,但文件“sendmail.PHP”使用的是我系统中不存在的文件:/usr/sbin / sendmail.

XAMPP的当前版本是:1.8.3,最近更新.

是否可以在XAMPP for Linux中使用“mailtodisk”?如果是的话,在我的情况下我需要做什么?

解决方法:

它不存在,但这是我的mailtodisk脚本:

/选择/ LAMPP / mailtodisk / mailtodisk:

#!/opt/lampp/bin/PHP
<?PHP
$input = file_get_contents('PHP://stdin');
$filename = '/opt/lampp/mailoutput/mail-' . gmdate('Ymd-Hi-s') . '.txt';
$retry = 0;
while(is_file($filename))
{
    $filename = '/opt/lampp/mailoutput/mail-' . gmdate('Ymd-Hi-s') . '-' . ++$retry . '.txt';
}
file_put_contents($filename, $input);

您的XAMPP安装可能不在/ opt / lampp文件夹中,如果不是,您需要编辑脚本(尽管它不必存在于XAMPP文件夹中).

确保您的mailtodisk脚本可以由任何人(chmod 755 mailtodisk)运行,并且您的mailoutput文件夹可以由任何人(chmod 777 mailoutput)写入.

然后你的PHP.ini文件(/opt/lampp/etc/PHP.ini)应该有:

sendmail_path=/opt/lampp/mailtodisk/mailtodisk

每次编辑PHP.ini文件时,都必须重新启动Apache.

如果您不想发送电子邮件,安装sendmail是过度的.

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...