The latest PHP2Shell vulnerabilities show how important it is to secure PHP installations against malicious actors. One very effective security measure is using AppArmor.
In this article I want to showcase how I use AppArmor profiles (or more accurately, AppArmor “hats”) to secure my PHP setup, utilizing Apache2 and PHP-FPM.