What is the error???
If your script generates output and doesn't have a terminal, things can go wrong. This could be your problem (running from the commandline, you have a terminal. If run from cron, you don't have a terminal). But all this is just a guess, 'cause you don't tell us what is going wrong.