OK, just tested under Joomla! 2.5 with no issues. I was able to place the code without issues. Are you using K2 2.5.7? If not update. If yes, try to install the SVN version of K2 at getk2.org/assets/svn/. If you still have the issue then probably you need to check your configuration again.