[eluser]evilgeoff[/eluser]
Couple things right off the bat...and this is very old so I'm sure no one is going to read this but what the hay. ffmpeg bit rates are in bits no kbits/s so -ab 32 should be -ab 32k (it knows that k is). Secondly do this same command on the command line and see if it works....it will spit out an explanation if it doesn't.
This command should work.
exec("ffmpeg -i ".$s." -ar 22050 -ab 32k -f flv -s 320x240 ".$d)
again I doubt anyone is still paying attention but if you have any questions about this let me know.