Install the PHP microagent

The PHP microagent has two parts: a PHP extension and a Sqreen daemon. Sqreen requires both parts to secure your PHP web applications.

The Sqreen PHP extension performs the PHP code instrumentation. It is a compiled extension (like the MySQL or ODBC extensions) that uses the PHP engine's API. It inspects the PHP internal state to collect signals and apply the configured plugins' actions.

The Sqreen daemon for PHP provides a long-running background process. It enables the microagent to upload batches of reports to the Sqreen Platform, operate plugins, and perform asynchronous activities.

  1. Review PHP microagent compatibility to confirm that the Sqreen Microagent for PHP is compatible with your PHP application.
  2. Sign up to create your Sqreen account.
  3. Fetch your organization token. From the Sqreen Dashboard, access Account Settings > Environments & Tokens. Your token begins with env_org_. Take note of the token.
  4. From Terminal, run the following command to install both the PHP extension and the Sqreen daemon.
    curl -s https://download.sqreen.com/php/install.sh > sqreen-install.sh \
    && bash sqreen-install.sh [YOUR ORG TOKEN HERE] "[YOUR APP NAME HERE]"
    
  5. Restart your web application server.
  6. Visit your website or query your application to complete the installation.

Install in multiple environments

Typically, you install the Sqreen microagent in your production environment, but you can install it in multiple environments. Use a unique name describing the application and different token for each environment such as production, staging, and development.

  1. From the Sqreen Dashboard, navigate to Account Settings > Environments & Tokens to fetch a token associated to an existing environment or add a new one.
  2. When creating a new environment, Sqreen automatically creates a new token and associates it with it. Take note of the new token.
  3. Set up your application name and SQREEN_TOKEN in the Sqreen microagent configuration file.

Uninstall

To uninstall the PHP microagent, remove the PHP extension and the daemon from your application.

Alternative install methods

The Sqreen microagent installer may not suport more advanced needs or custom PHP setups. Access the following documentation for detailed instructions.