Skip to main content

Configure PHP agent

The standard configuration for all agents uses this order of precedence.

You may use a YAML configuration file or environment variables to configure the agent when running your application:

  • You can use environment variables to configure your build

  • You can create your own YAML configuration file or use this YAML template that contains all valid properties for the PHP agent

Tip

Use the Contrast agent configuration editor to create or upload a YAML configuration file, validate YAML and get setting recommendations.

PHP YAML template

Use this template to configure the PHP agent using a YAML configuration file. (Learn more about YAML configuration.)

The agent looks for a configuration file in the following order and uses the first one it finds. It accepts the file name contrast_security.yaml or contrast_security.yml:

  • The file named by the CONTRAST_CONFIG_PATH environment variable

  • /etc/contrast/php/

  • /etc/contrast/

  • /etc/

The agent does not read a configuration file from your application directory. If it finds one there, it writes a warning to the log.

https://docs.contrastsecurity.com/common-agent-config/php_contrast_security.yaml