Installation of the PHP agent (Enterprise Linux)


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.

Standard PHP Application

From a terminal, add our custom repository containing the Sqreen agent packages using our custom script:

curl -s | sudo bash

Then install the Sqreen PHP extension and the Sqreen daemon:

sudo yum install sqreen-agent sqreen-php-extension

Finally, add your Sqreen token in the agent's configuration (your Sqreen token is available on the application dashboard you set up in the previous step).

sudo /usr/lib/sqreen/sqreen-installer config YOUR_TOKEN_HERE

Don't forget to restart your HTTP server.

Install the agent outside production environment

Typically you will install the Sqreen PHP agent in your production environment, but you can create several applications using your Sqreen dashboard, and specifying the environment (development, staging, production). A unique Sqreen token will be provided for each of your applications.

Basic configuration

After installing the agent, your configuration will be stored in the configuration file sqreen.ini. At the moment this file contains only your Sqreen token.

The Sqreen PHP agent provides flexible configuration settings. Refer to Advanced Configuration in PHP for more detailed information.

All done! 🙌

At this point, the PHP is ready to use! No further configuration or installation is necessary in most cases. However, if you need to e.g. use the daemon on another machine, then please read on to the next section.

Disable the agent

You can disable the agent anytime by visiting your Sqreen Dashboard, go to the Settings section and switch off the Sqreen status.

Uninstall the agent

To uninstall the Sqreen agent, simply remove the packages:

sudo yum erase sqreen-agent sqreen-php-extension

Custom repository setup

If you require more control or configuration over how these two components are installed, this section will help you understand in more detail how each component can be installed and configured separately.

The Sqreen PHP agent is available on a hosted repository. Use the following steps to manually install the Sqreen repository in your application.

Begin by installing pygpgme and yum-utils. This will upgrade yum to be able to handle gpg signatures, and will install some helpful tools for installing source-based RPMs.

sudo yum install pygpgme yum-utils

Next, use this command to create a read token and output the necessary repository configuration. Replace UNIQUE_ID with a unique identifier of your choice for your system:

UNIQUE_ID=`hostname -f` && curl "${UNIQUE_ID}" > /etc/yum.repos.d/sqreen_sqreen.repo

Then update the package cache:

sudo yum -q makecache -y --disablerepo='*' --enablerepo='sqreen_sqreen'

You can now install the daemon sqreen-agent as well as the sqreen-php-extension:

sudo yum install sqreen-agent sqreen-php-extension