In "Where Silence Has Lease," the powerful Nagilum declares its intention to do experiments on the crew, so that it can learn more about the concept of death. It claims that up to one-half of the Enterprise's crew may be killed.
Captain Picard and Commander Riker decide to arm the auto-destruct sequence, instead of attempting to engage the entity. Granted, photons and phasers probably wouldn't work on a being that can manipulate space and destroy crew members so casually, but would it really hurt to try?
The ship's exploding would kill everyone; phasers and photons may be successful, and even if they weren't, the worst that Nagilum could do is destroy everyone on the ship anyway.