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

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – 在XAMPP for Linux中使用mailtodisk / mailoutput脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Windows不同,我在 Linux中使用“mailtodiskPHP选项时遇到了麻烦.看起来它甚至不存在.

在“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是过度的.

脚本宝典总结

以上是脚本宝典为你收集整理的php – 在XAMPP for Linux中使用mailtodisk / mailoutput全部内容,希望文章能够帮你解决php – 在XAMPP for Linux中使用mailtodisk / mailoutput所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。