When he wasn’t battling music piracy allegations and helping to launch Facebook, tech entrepreneur Sean Parker was fighting a much more common problem: allergies.

The co-founder of Napster and former president of Facebook happens to be deathly allergic to peanuts, tree nuts (pecans, almonds, etc.), and shellfish. The vulnerability has landed him in the hospital at least 14 times in the last five or six years, including once while attending the World Economic Forum in Davos, he says.

Now, Parker, who has also invested in several startups including Spotify, aims to put his money where his mouth is—or, at least, to allow him and others with food allergies to eat whatever they want. The tech investor is donating $24 million to create a new allergy research center that will bear his name at Stanford University, with the goal of developing a way to cure allergies—from peanuts to pollen—with a single treatment.

“For this to be a cure, you have to walk out the door knowing you can eat things and not be afraid,” Parker says. “It’s very frustrating; people who know me well know that I’m kind of obsessed with food and I consider myself a foodie.”

The number of people reporting allergic reactions to food doubles every decade, with a quarter of those people experiencing a life-threatening anaphylactic reaction—which often involves difficulty breathing—during their lifetime, according to Kari Nadeau, a Stanford immunology specialist. Nadeau will lead the Sean N. Parker Center for Allergy Research, which officially opens on Wednesday and will ramp up operations over the next two years.

The idea for the center, Parker says, was inspired by Facebook COO Sheryl Sandberg, who approached him about it. Sandberg and her family had been working with Nadeau, “and loved her and wanted to try to scale up what she was doing,” according to Parker.

Parker, who also has asthma in addition to anaphylactic allergies, says his near-fatal reactions to certain foods unknowingly led him to change his dietary behavior altogether. “I’ve come pretty close to the edge a couple of times,” he says.

For example, although he eats out three times a week, he says he never eats dessert at restaurants or passed hors d’oeuvres, and he says he smells his food before he eats it. “I have some sort of a sixth sense about it,” says Parker, adding that he even had an unexpected close call while dining at high-end Japanese eatery Nobu this week. Though he didn’t expect the sushi restaurant to use any nuts, it served pistachio ice cream. “It got within six inches of my mouth,” Parker says.

Still, for a former venture capitalist with a successful track record backing startups, Parker felt that philanthropy was a better route to toward a cure for allergies than starting or funding a biotech firm. “You can either play a role on the medical research and philanthropic side or as a venture capitalist on the side of commercialization of the company, and I think it’s a little dicey to be doing both,” says Parker.

And if a new cure-all allergy drug does eventually arise from the center’s research, Parker says he doesn’t envision building a pharmaceutical company around it—though he says he could try to help connect the researchers with venture capitalists to get the drug to market faster.

Parker is also working on a few of other philanthropic endeavors related to cancer research, “with much larger amounts of capital,” he says. “I’m trying to maintain a separation between things that are purely altruistic and things that are purely capitalist,” Parker says, adding that he does have “some things in the middle,” such as his backing of electronic cigarette company NJOY. Because the company’s e-cigarettes don’t contain tar or carcinogens, he believes his investment is, in a sense, helping to combat cancer, “almost in the form of venture activism,” Parker says.

For now, he’s hoping his center will come up with a one to two-week allergy treatment in the next few years, and a single-visit panacea in the next five to 10 years.