LoginSignup
2
1

More than 5 years have passed since last update.

mail()関数で「sh: -t: command not found」となりメール送信出来ない問題対応

Last updated at Posted at 2018-01-23

現象

自分でソースからビルドしたphpにて遭遇。
phpのmail()関数でメールを送信しようとしたら以下エラーでメール送信できなかった。
メール送信のログ /var/log/maillog にも出力なし。

sh: -t: command not found

現状確認

悪い例
$ php -i | grep sendmail_path
sendmail_path => -t -i => -t -i

修正

  • /etc/php.ini
  • /etc/php-cli.ini
+ sendmail_path = /usr/sbin/sendmail -t -i

httpdを再起動。
もしphpプロセスで動かしっぱなしのものがあればそれも落としあげし修正完了。

以下であればok
$ php -i | grep sendmail_path
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1