与 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 = [email protected]
; 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]
我在本地主机主页中看不到用于测试默认邮件表单的“邮件”链接,因为它存在许多像这样的崩溃:
Notice: Undefined variable: TEXT in /opt/lampp/htdocs/xampp/start.php on line 12
Obs:尽管本地主机主页出现此错误,但我运行项目没有问题。
事实上,菜单中似乎没有“邮件”链接(我已经搜索了源代码)。
我不知道此信息是否有任何帮助,但文件“sendmail.php”使用了我的系统中不存在的文件:/usr/sbin/sendmail
.
XAMPP的当前版本是:1.8.3,最近更新了。
是否可以在 XAMPP for Linux 中使用“mailtodisk”?如果是的话,根据我的情况我需要做什么?
它不存在,但这是我的 mailtodisk 脚本:
/opt/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 就有点矫枉过正了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)