Symfony Cache with Database

The Symfony Cache component has a large number of possible adapters for cached information.

For caching in the database, you can use the following PdoAdapter for Doctrine and configure the following dimensions:

                adapter: AppCache
  class: Symfony\Component\Cache\Adapter\PdoAdapter
    - '@doctrine.dbal.default_connection'

Symfony thus generates a database table within the default database connection for the cache entries.

This has particularly performance gains and is clearer compared to the default file system variant. This is especially recommended for a Docker environment, because the slow file system does not need to be diluted.

Symfony 5 Exception “The annotation was never imported.”

One reason for the error message may be, that it is actually an annotation, that is invalid, but is in the vendor code. Then you should ignore them.

Error message:

Doctrine\Common\Annotations\AnnotationException : [Semantical Error] The annotation "@suppress" in method Monolog\Formatter\LineFormatter::normalizeException() was never imported. Did you maybe forget to add a "use" statement for this annotation?

If you ignore the annotation with the static call to in the config/bootstrap.php:



Protractor configuration Headless Chrome and Firefox

To run Selenium tests in Firefox and Chrome in Headless mode with Protractor, the following configuraton can be used in the protractor.conf:

exports.config = {
  multiCapabilities: [
      browserName: 'chrome',
      chromeOptions: {
        'args': ['--headless']
      browserName: 'firefox',
      firefoxOptions: {
        args: ['--headless']
      'moz:firefoxOptions': {
        args: ['--headless']

Secure Jenkins with self-signed SSL certificate

So that Jenkins can only be reached via HTTPS on Linux, first you have to create an SSL certificate in the folder:

mkdir /var/lib/jenkins/ssl_cert/
cd /var/lib/jenkins/ssl_cert/

openssl req -newkey rsa:2048 -x509 -keyout cakey.pem -out cacert.pem -days 3650

Then you can convert this certificate for the Java Key Store:

openssl pkcs12 -export -in cacert.pem -inkey cakey.pem -out identity.p12 -name jenkins
keytool -importkeystore -destkeystore identity.jks  -srckeystore identity.p12 -srcstoretype PKCS12

and import into the Java Key Store:

keytool -import -file cacert.pem -keystore trust.jks

In the end, only the Config has to be adjusted:

sudo vi /etc/sysconfig/jenkins

with the values:






And the service will be restarted:

chown -R jenkins: /var/lib/jenkins/ssl_cert/*
chmod 600 /var/lib/jenkins/ssl_cert/*

sudo systemctl restart jenkins

Create your own metrics in AWS Cloudwatch

To use CloudWatch Create your own metrics, by e.g.. alarm and to operate monitoring with the data of the application, can you use the aws-php-sdk use the following code:

 $client = new CloudWatchClient([
        'region' => 'eu-central-1',
        'version' => '2010-08-01',
        'credentials' => [
            'key'    => 'xxx',
            'secret' => 'xxx
$result = $this->client->putMetricData(array(

    'Namespace' => 'MyProject',
    'MetricData' => array(
            'MetricName' => 'MyMetric,
            'Timestamp' => time(),
            'Value' => 1,
            'Unit' => 'Count',
            'Dimensions' => array(
                    'Name' => 'Environment',
                    'Value' => 'test',

Use Docker Shell Alias on Linux

In order to use the Linux Shell to use the usual aliases such as Ll for ls -lh to use, you have to use the following trick:

Since the login via sh is not a Linux login shell, the alias definitions are /etc/profile.d not loaded at login.


Enough, deal with Sh –login in the container, then the alias definitions are available.

DockerFile PHP with XDebug and Amazon Linux 2

A DockerFile for a PHP 7.2. Environment with XDebug for a Symfony 4 Environment on Amazon Linux 2:

FROM amazonlinux:2.0.20190823.1

RUN yum install -y

# install php
RUN amazon-linux-extras install -y php7.2
RUN yum install -y php-devel.x86_64 php-xml.x86_64 php-pecl-zip.x86_64  php-intl.x86_64

#install xdebug
RUN yum install -y gcc make
RUN yum install -y php-pear.noarch
RUN pecl install xdebug
RUN echo 'zend_extension=/usr/lib64/php/modules/' >> /etc/php.ini

Docker Xdebug remote_host setzen in Toolbox für PHPStorm

To debug with Xdebug and PHPStorm in the Docker Container, but gets the error message:

Connection was not established. Probably '' is incorrect

this is due to the, that Docker in the Toolbox variant for Windows has the placeholder not filled. So the IP of the PHPStorm computer has to be set manually.

To do this, you manually set the value of xdebug.remote_host to (the IP Docker sets for the host, can varnise) cli interpreter options: