是否可以指示PHP在PHP.ini中使用后缀配置?

是否可以指示PHP在PHP.ini中使用后缀配置?,php,phpmailer,ubuntu-14.04,postfix-mta,Php,Phpmailer,Ubuntu 14.04,Postfix Mta,是否可以使用postfix的配置集配置PHP发送电子邮件 WordPress(通过PHPMailer)依赖这些设置在php.ini中保持正确: ;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 a

是否可以使用postfix的配置集配置PHP发送电子邮件

WordPress(通过PHPMailer)依赖这些设置在php.ini中保持正确:

;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 = "/usr/sbin/sendmail -t -i"

; 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().
;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

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
mail.log = /var/log/mail.log
; Log mail to syslog (Event Log on Windows).
;mail.log = syslog
Postfix被配置为使用谷歌的SMTP服务器,并确认在操作系统(Ubuntu 14.04)级别工作

PHPMailer失败(来自WordPress),错误为:

无法实例化邮件函数


事实证明,因为我使用的是php fpm,所以在/etc/php5/mods available/zzzz_custom.ini中设置了一些我不知道的设置

将sendmail路径添加到该文件对我有效:

sendmail_path=/usr/sbin/sendmail -t -i

这种组合对我来说是现成的。
/usr/sbin/sendmail
是否存在?cli和web服务器SAPI是否有单独的php.ini文件?您可以尝试使用SMTP到localhost,这是与本地postfix实例对话的推荐方式,因为它比调用sendmail二进制文件更快。谢谢您的回复。Sendmail确实存在于该路径。有单独的php.ini文件-两个文件中的设置相同。它是php fpm,如果这有区别的话。我正在重新启动php fpm而不是apache(但已经尝试了两者)。我现在也尝试了SMTP设置-相同的错误。如果您遇到此错误,则无法使用SMTP,因为只有在调用mail()时才会发生此错误。谢谢-您是对的。还有另一个ini文件覆盖了我对php.ini所做的任何设置(参见我的答案)。谢谢你的帮助:)