sh: -t: command not found when sending email

s_2_s

Well-Known Member
Aug 9, 2004
215
0
166
Hello
i face the error
sh: -t: command not found

while i make a simple php script which only have mail function and excute this script from shell
by example

mail.php

<?
mail("[email protected]xxxxx.com", "My Subject", "Line 1\nLine 2\nLine 3");

?>

then from shell as root

php mail.php

i get
sh: -t: command not found

please advise
 

DaveUsedToWorkHere

Well-Known Member
Dec 28, 2001
689
1
318
This is likely related to a local configuration on the server. Using the mail function as you described should work fine.

Since the error is related to sh, it looks like something might be up on the system. Try running the following to make sure that php is available and you are using the right path.

Code:
which php
It can't hurt to force the script to use the above output iwht a shebang line like: #!/usr/local/bin/php

This is more of a php related question though and I'd try to head in that direction. You might want to look into some php tutorials on error handling.