PHP on command line displays "Out of Memory", no file name, line number or memory value

After re-reading your comments above and your original post - you ran ulimit -a as root - but you said that root is unaffected.

Your issue here is ulimit, but at a user level. Log in as your dan user and run ulimit -a and you will probably find your memory is limited.