Is it possible in CiviCRM to change extension of cached php files from .php to something else (e.g. .php_ or .txt)?
I ran into this as well. The issue is caused by the CachedCiviContainer cache -- which will write a .php file.

A workaround for this is to set the following constant in the civicrm.settings.php file:

define('CIVICRM_CONTAINER_CACHE', 'never');


Not ideal, as it disables the container cache altogether. But it avoids these issues.