Avoiding triggers can also help prevent attacks of porphyria. Porphyria can be triggered by many different environmental factors that can be difficult to avoid. Talk to your healthcare provider for tips to prevent attacks.