He knew he was going to die.

This Halloween marks the 20th anniversary of River Phoenix’s shocking overdose at Johnny Depp’s LA nightclub. Now one of the last people to see Phoenix alive that night recounts what happened.

In his forthcoming book “Running with Monsters,” former Thelonious Monster frontman and “Celebrity Rehab” therapist Bob Forrest writes about his friend Phoenix’s downward spiral and sudden death.

At the time, 23-year-old Phoenix was one of the most famous young movie stars in the world, a respected actor with a pristine public image: a hippie vegan pacifist, beloved by all who knew and worked with him.

The reality, Forrest writes, was much darker.

Phoenix was a frustrated rock star and, in the days leading up to his death, he’d holed up with Red Hot Chili Peppers’ guitarist John Frusciante and embarked on a massive drug binge. “[River] stayed with John for the next few days, and probably didn’t get a minute of sleep,” Forrest writes. “The drug routine stayed pretty consistent for all of us. First, smoke crack or shoot coke directly into a vein for that ninety-second, electric brain-bell jangle. Then shoot heroin to get a grip and come down enough to be able to carry on a conversation for a few minutes before you start the cycle again.”

The night he died, “River and John stumbled in” to the Viper Room, Forrest writes. Also there were Phoenix’s brother, Joaquin, and sister Rain; his girlfriend Samantha Mathis; Red Hot Chili Pepper Flea, also a close friend; and Depp. As soon as Phoenix and Frusciante arrived, Forrest writes, cocaine was passed around.

He was alarmed by Phoenix’s condition.

“River was obviously wasted and was as unsteady as a boxer who had taken one too many headshots during a fifteen-round bout,” Forrest writes. While watching Depp’s band perform, Forrest felt someone tap him on the shoulder.

It was Phoenix, ghostly pale.

“Bob,” he said, “I don’t feel so good. I think I’m OD’ing.”

Forrest writes that Phoenix got a second wind and waded back into the crowd. A few minutes later, someone shouted over the music to call 911.

Phoenix had been dragged outside. He was on the sidewalk, seizing. When the EMTs arrived, Forrest writes, Phoenix was still alive, and Flea jumped in the ambulance for the ride to Cedars-Sinai Hospital.

Forrest jumped in his car and, with a friend, raced to the hospital. When he got there, he saw Mathis standing by herself in the hallway, tears streaming down her face.

At that moment, he writes, he knew that Phoenix was dead.

Forrest called Depp, who asked, “How’s your friend?” He hadn’t realized that Phoenix was the one carted away from the Viper Room.

“Dude,” Forrest said. “River’s dead.” After a long pause, Depp said, “Oh my God,” and hung up.

The next morning, Depp, along with everyone else who knew what happened that night, left town.

‘Running with Monsters’ (Crown Archetype) is out Oct. 1.