‘IT literally nearly killed me,” Simon Wells said candidly of his experience directing the troubled remake of “The Time Machine” – based on the novel by his great-grandfather, H.G. Wells.

Wells, an animator making his live-action debut at the helm of the $80 million film opening Friday, said unfavorable Internet gossip, technical snafus and worries about changing the classic novel combined to make him miserable.

At one point while making the movie, he was suffering from such severe exhaustion that he asked for another director to be brought in for the final 18 days of shooting.

“I just got up one day and had a kind of panic attack . . . it overwhelmed me and, at that point, I called [producer] David Valdes and said, ‘I can’t physically keep doing this,’ ” said the 39-year-old Englishman during a publicity stop in Manhattan. “So I stepped down.”

“The Time Machine” is a remake of the classic 1960 adventure about a scientist – played in this version by Guy Pearce – who travels 800,000 into the future, when the human race has evolved into two distinct species.

It’s got elaborate special effects, intricate stunts and massive sets, making it the kind of big-event movie – it was originally scheduled as DreamWorks’ big Christmas release before it was postponed – that might challenge even a seasoned director of live-action extravaganzas.

Gore Verbinski, another animator-turned-director (“The Mexican”), agreed to fill in – on condition that he consult with Wells and that after Wells recuperated, the original director would return to oversee the editing and other post-production work.

“He saved my life,” Wells said of Verbinski.

Besides technical problems with the sets, stunts and effects, Wells was also dogged by a steady stream of negative gossip on the Internet.

One item quoted his female lead, Irish pop star Samantha Mumba, as saying that 30 days of footage had to be reshot because DreamWorks founder Steven Spielberg changed the storyline.

What actually did happen, Wells insisted, is that three days’ filming – not 30 – was scrapped.

And “Steven was not involved in the decision, and the storyline did not change,” he said.

Wells also admits he’s concerned people will complain about changes to the original story, which his great-grandfather (who died in 1946, 15 years before his birth) published in 1895.

The hero of this version, for instance invents his machine not out of scientific curiosity but because he wants to go back in time to prevent the death of his fiancee.

“There will certainly be purists who feel there’s a betrayal of the original document,” said Wells, who noted he has since learned to handle the pressure – but hasn’t decided on his next project.