cause you are using "" to enclose the strings and because you put "smiley" between them too it's not enclosed. I recommend using ' to enclose strings so you can use the " for html enclosing.
code:
$text = str_replace(':)', '<img alt="smiley" src="smilies/grin.gif" />',