My PhD situation is giving me anxiety attacks. Is quitting (and losing 2 years) my only option? I am currently in my second year of my PhD and I am having a horrible time. I feel like I am not cut out for academia and I frequently have anxiety attacks. I would like to do something else, and if it was a normal job I would definitely start looking for another job.

I'm worried I'll lose my reference (And he's a good reference to lose :() and I'm also feeling guilty. I have taken two years of funding and now I just want to leave unpublished? Ethically I feel terrible. 

The trouble is it is massively affecting my mental health. I have had to seek help from the student services with this. I cry all the time. I've lost my motivation. I'd really like a job in the charity sector or in health education where I can help people and feel like I make a difference. 

The trouble is I don't imagine quitting a PhD or considering leaving a PhD looks particularly great on a CV. I have so many reasons to leave and so many to stay. Any advice?
1- First, you would not be losing 2 years. In those 2 years, you learned things and developed your skills. In your current mental health state, it is probably hard to view this experience as positive, but I suggest you give it a try. Maybe make a list of the skills and experience you gained with your PhD.

2- Get professional help, as stated in the comments. Once you feel a bit better, you'll be ready to take a decision.

3- I get the feeling that most of your reasons to stay are linked with advisor-related guilt (funding, no publication, no reference for future work). You would be surprised, but most advisors are human, and did a PhD. He/She can probably understand your problems and help you reach a decision. Maybe he/she could even suggest some ideas to reduce your guilt (quit the program, but write an article on the side or help another person to pick up where you left).

If your advisor is not human (which, seems to happen sometimes), there's probably a department head that could mediate discussion between you and your advisor about quitting the program. But you need to discuss with your advisor.

Good luck and take care.