I want to better understand how PHP performance changes in this situation, to see what’s the recommended approach to take.
Let’s say you run 5 isolated websites on a LEMP stack, with PHP-FPM. There’s a need to include a PHP file that does some processing for all 5 websites. So what’s the better, more performant approach:
- Have that one file somewhere on the server and
include()it on all 5 websites, so it’s easier to make changes to that one file. OR.
- Include a copy of that file with each website, so there are 5 identical files; one per website.
I’m curious how PHP’s performance changes between putting a load on that one file vs loading individual files as needed by each website.
Would appreciate some insight on this.