meza
meza copied to clipboard
Run PHP validation on all jinja-templated PHP files
Run something like the following on all PHP files generated by a jinja template:
php -d error_reporting=32767 -l /path/to/file.php
Ideally make it so the file is tested first and only put in place if it passes validation. I think this is doable by simply modifying our Ansible template tasks by adding the validate
line below:
- template:
src: somefile.php.j2
dest: /path/to/somefile.php
owner: apache
group: apache
mode: "0644"
validate: php -d error_reporting=32767 -l %s
This validate
line would only be able to be added (a) on servers with PHP and (b) after PHP has been installed on those servers. The former should already be satisfied (why would be be putting PHP files on servers without PHP?). The latter is probably satisfied, but if it's not it shouldn't be any big deal to move those files after PHP is installed (they couldn't be in use anyway).