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

CREATE PHP csv File with Umlauts for Excel

To create a csv file, where the umlauts are correctly coded, you have to be in your project, which is normally encoded UTF-8, encode the umlauts according to UTF-16LE. This encoding can be viewed from Windows and Mac.

$file = fopen('file.csv', 'w');
foreach ($rows as $row) {
 $row = array_map(function($cell){
 return mb_convert_encoding($cell, 'UTF-16LE', 'UTF-8');
 }, $row);
 fputcsv($file, $row, ';');

Recursively delete directories Gau Frette FTP adapter

To with FTP recursively delete files and directories adapter Gau Frette, you can apply following trick to avoid the error message:

ftp_rmdir(): Directory not empty.

1. just delete all files

2. then delete the lowest directories up to the top:

 * @param Filesystem $fileSystem
function deleteAllFilesInDirectory(Filesystem $fileSystem)
    // delete files first, than directories
    foreach ($fileSystem->keys() as $key) {
        if (!$fileSystem->isDirectory($key)) {
    $keys = $fileSystem->keys();
    usort($keys, function (string $a, string $b){
        $aCount = substr_count($a, '/');
        $bCount = substr_count($b, '/');
        return $bCount <=> $aCount;
    foreach ($keys as $key) {

Successfully passed certification to become a Zend certified engineer

At the 1. March I made successfully the examination for which I learned the last few months. As was to be expected, were the questions very, very tricky, but the preparation has paid off.



I can anyone recommend before from the Book PHP7 Zend Certification Study Guideto read:

In addition, you should all tests on the page to 80% can successfully answer, then you're ready for the exam.

Sign up for the exam

You can be on the login page for the examination , take one then nearby in a testing center of their choice can under strictest conditions.

Annually there is a voucher for the exam, If you're lucky.

PHP: Parse Error: syntax error, unexpected ‘:’, expecting ‘;’ or ‘{‘

The very cryptic error message

Parse Error: syntax error, unexpected ':', expecting ';' or '{'

It is in most cases a PHP7 incompatibility.

The code contains a language feature, What is only available at PHP7:

Return type definitions (Definition of the return value). Example:

function myFuntion($input): array
    return ['foo'];

This can strength enable, the function must return an array, otherwise an TypeErrror is thrown.

To make the code less PHP version running, muss man die Return Type Definition entfernen:

function myFuntion($input)
    return ['foo'];

Special case: composer more…

Project: baby

The just completed project baby deals with the issues relating to the development of the own child:

  • How great my child be in x years
  • My child is like in x years
  • Is my child too hard or too thin
  • What dress size is wear it when?

The Web page is to help parents find out, When you need to buy what dress size, the approaching winter/summer home to have the appropriate.

Parents can thus einschätzne, If the child is too thin or too thick for your age/size/weight ratio.

The following technologies were used for the realization:

Symfony 3, Docker, MySQL, PHP, GIT, Google material design, Amazon AWS

Amazon automatic price adjustment tool

I developed a tool just for a customer, with the one the prices of own goods at Amazon can automatically adapt. In the competition to Goth are determined analyzes reliability and therefore a fair price condition of the product and seller for the goods. There are all the data, about the API are available for the determination of price with used, as e.g.. Seller feedback (Reviews of the dealer), whether Amazon itself sent, Shipping time and much more.

The tool compares the rates between the various Amazon optional platforms in Europe (DE, UK, IT, IT, FR) Platforms but also outside Europe, like Japan or America and händelt the different currencies.

The result can be sent directly to Amazon via the API and the prices will be immediately updated.

Amazon Preisanpassung

Screenshot Preisanpassungs Tool


The application is in PHP with symfony 3 written and has a front end with Twitter bootstrap 3 and a MySQL database. There's also a vagrant environment for developing with PHP7. 1 and nginx. Be carried out can the whole thing with a simple XAMPP environment or vagrant virtual box at the customer locally on a PC.

If you are also interested in such a tool, allows you to Contact.

PHP How to debug Segmentation Faults

To Segementation faults, like PHP7 currently occurring in to determine and analyze, can you proceed in the following way

1. Specifying the location for the core dumps

echo '/tmp/coredump_%e_%p' > /proc/sys/kernel/core_pattern

2. enable core dumps in PHP-FPM

in the file: PHP-fpm.conf:

rlimit_core = unlimited     ; vorher: 0

3. Restart PHP FPM

service php-fpm restart

4. Analyzing the core dumps with gdb more…