Installation of the PHP agent (alpine)

TL;DR

Installing the Sqreen PHP agent enables you to monitor the security of your application and block attacks in real-time. Installing Sqreen in your PHP application takes less than a minute:

  • Sign up to Sqreen to create your account
  • Pick up your first application name and language. The name of the application can be the name of the repository, or anything that will help you identify the app in your Sqreen dashboard
  • Follow the procedure detailed below

This procedure will install both parts of the agent: the language extension and the daemon. Both parts are necessary for the agent's operation. Read more about the structure of the PHP agent.

Install the extension

To install the extension, we provide you some apk packages that you can Download it manually from here or in this way:

$ curl https://download.sqreen.io/php/sqreen-php-extension/alpine/sqreen-php-extension-latest-alpine.tar.gz -o sqreen-php-extension.tar.gz
$ tar xf sqreen-php-extension.tar.gz

The Sqreen PHP extension files will be extracted on your disk.

Then install the correct apk package:

apk add --allow-untrusted <PHP version>/sq-ext-alpine-*.apk

If you use a Dockerfile, here's an example of step to add in the Dockerfile:

RUN mkdir /tmp/sqreen-apk-packages && cd /tmp/sqreen-apk-packages \
  && curl -L -f -O https://download.sqreen.io/php/sqreen-php-extension/alpine/sqreen-php-extension-latest-alpine.tar.gz \
  && tar -xzvf sqreen-php-extension-latest-alpine.tar.gz \
  && apk add --allow-untrusted <PHP version>/sq-ext-alpine-*.apk \
  && rm -r /tmp/sqreen-apk-packages

Install the sqreen-agent

We don't provide yet packages for the sqreen-agent on alpine.

However if you use containers, we advise you to launch it in another container. For instance you can use this docker image: https://hub.docker.com/r/sqreen/php-agent/