[PHP] PHP mail() error (“sh: -t: command not found”)

PHP mail() error (“sh: -t: command not found”)

 

PHP code

1
2
3
4
5
6
7
8
9
10
<?php
$fname = "jirak";
$mail_from = "master@jirak.net";
$header = "Return-Path: <$mail_from>\n";
$header .= "From: $fname <$mail_from>\n";
$to = "admin@jirak.net";
$subject = "test";
$body = "aaaauhahahaha";
mail($to, $subject, $body, $header, '-f'.$mail_from);
?>

 

exec result

1
2
# php mail.php
sh: -t: command not found

 

 

처음 보는 에러라서 흠칫…
대체 -t 는 근거가 뭘까 싶었는데..

php.ini 의 설정과 관련이 있음

 

 

정상(??)서버

1
2
3
4
# php -i|grep sendmail
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
Path to sendmail => /usr/sbin/sendmail -t -i

 

 

문제의 서버

1
2
3
4
# php -i|grep sendmail
sendmail_from => no value => no value
sendmail_path => -t -i => -t -i
Path to sendmail => -t -i

앞의 sendmail 이 없으니 발생하는 에러로 보여짐

 

 

해결

php.ini 수정

default

1
;sendmail_path =

 

변경

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

 

 

 

 

About KENNETH 19694 Articles
지락문화예술공작단

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.