Failed ajax request or invalid json returned (in galley)

Well, when I change cache folder and cache/t_compile to 777, Everything back to work normally. However, here How should file permissions be set? - #2 by ctgraham, it is not safe.