The output of PHP files is HTML. That HTML will be compressed using [the code in this question][1]:

    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript application/json

That's all you need to do (assuming mod_deflate is enabled for Apache).

  [1]: https://webmasters.stackexchange.com/questions/9995/gzip-compress-offline