Docker php:7.2-fpm and openssl extension

While running the installation of php 7.2 fpm of docker I ran into the issue caused by the installation of the extension openssl. Using docker-php-ext-install openssl resulted in a error config.m4 not found , I thought there would be a easy way to solve this but no.
I had to create a script based on docker-php-ext-install to just install the openssl extension by moving the mv config0.m4 to config.m4


In the Dockerfile where I’m building From php:7.2-ppm

RUN chmod 0750 / && cd / && ./

In the file


set -e

# prefer user supplied CFLAGS, but default to our PHP_CFLAGS

if [ -d /usr/src/php ]; then
docker-php-source extract
if [ -z “$srcExists” ]; then
touch /usr/src/php/.docker-delete-me

cd /usr/src/php/ext

if [ -e /lib/apk/db/installed ]; then

if [ “$pm” = ‘apk’ ]; then
if [ -n “$PHPIZE_DEPS” ]; then
if apk info –installed .phpize-deps-configure > /dev/null; then
elif ! apk info –installed .phpize-deps > /dev/null; then
apk add –no-cache –virtual .phpize-deps $PHPIZE_DEPS

cd openssl
mv config0.m4 config.m4
[ -e Makefile ] || docker-php-ext-configure openssl
make install
find modules \
-maxdepth 1 \
-name ‘*.so’ \
-exec basename ‘{}’ ‘;’ \
| xargs -r docker-php-ext-enable
make clean
cd “$popDir”

if [ “$pm” = ‘apk’ ] && [ -n “$apkDel” ]; then
apk del $apkDel

if [ -e /usr/src/php/.docker-delete-me ]; then
docker-php-source delete



PHP Taking advantage of Traits and Doctrine2 for less lines of code

I did this app a time ago (~1 year) with Doctrine2+Symfony2 with simple Entities basically I was mimicking an excel sheet copying the values from the sheet to the database and setting all up for web usage.

The main Class was Item, this had Sub Entities Location, Protocol, State, etc…

These named here Location, Protocol, State had the same properties (fields), they also had to have a incrementable “Code” field witch, this was a basic copy paste to fill the tables and increment the number. Didn’t want to write the code to the different Entities so I used a Trait in a very lazy way I declared


namespace Far\AssetManagerBundle\Entity;

trait TautoFill {

    public function getAndInsert($val)

        $valtmp = strtoupper(str_replace(' ','',trim($val)));
        $Res = $this->findBy(['code' => $valtmp]);
        if (count($Res) > 0 && $Res[0] != null) {
            $obj = $Res[0];


        } else {
            $tmp = $this->getClassName();
            $obj = new $tmp();
            // persist

        return $obj;

So in a easy use TautoFill I got the data auto inserted and related to the main Item, without much work. Using a trait made the code more dynamic and easier to reimplement in the different situations without compromising hierarchy of the Entities.

Mysql e output de erros

Engraçado tive um problema parecido mesma mensagem de erro e não tinha nada a ver com a Base de dados o problema é na config do servidor… Foda-se!

Re: ERROR 1033 (HY000): Incorrect information in file
Posted by: Stu Derby ()
Date: October 28, 2007 02:14PM

As best I can tell, this error message is produced whenever the DB is unable to perform INNODB recovery upon restart. The DB needs to assume on restart that it might have crashed, maybe power failure, and so there may be partially stored transactions in the log file that either need to be completed or unwound. If it can’t do that, recovery fails and the tables are therefore inaccessible, with this rather cryptic message.

I ran into this problem when restoring a slave DB, using the backup of the master. Someone had cleverly (not) increased the innodb_log_file_size on the slave but not the master and I was using the master’s data and log files with the slave’s my.cnf The only clues I got were the 1033 error message and the startup error message (in /var/log/mysqld.log on my system):
InnoDB: Error: log file /var/lib/mysql/ib_logfile0 is of different size 0 268435456 bytes
InnoDB: than specified in the .cnf file 0 536870912 bytes!

Making the slave’s log_file_size match the log file copied from the master made everything work (some 12 hours after I started on the problem).

I suspect there are several other ways to get this situation, probably corrupted or missing log files, path problems, etc. It would be nice if the DB would put out an error saying something like “recovery has failed, InnoDB tables not accessible” to help people focus on the earlier error (in my case the log file size issue).

Controlo de uso de CPU em perl

Fica aqui o codigo que escrevi simples mas modular o suficiente para ser replicado por mais pessoas.


Desculpem a mistura de Inglês com o Português.

# Verificar o tempo de idle do cpu e agir de acordo
# @version $Id: 5432 2011-05-05

# Permitir um tempo maximo de idle de x segundos
# Definir o tempo permitido em idle por esta var
our $processcount_cpuallowidletime = 120;
# Maximo de tempo que o processo ira ficar com controlo de idle time
our $processcount_cpuallowtotalidletime = 500;

# dormir durante x tempo porque o processo esteve sem fazer nada
our $process_sleeptime = 2;

# Guardar dados sobre idle process count
# Estrutura de dados para indicar o tempo de idletime
our %idletime = (
start => 0,
end => 0,
total => 0,

# $processcount pertence ao ficheiro "main" e nao deve ser definido aqui
# esta var indica se o processo esta a fazer algo se > 0

=item checkidle

Called function to validate idle time


sub checkidle {
if ($DEBUG > 0 ) {
syslog("debug", "inicio Verificar idle time pcount=".$processcount." t=".$idletime{'total'}." allow=".$processcount_cpuallowidletime." pslp=".$process_sleeptime);

if ($processcount == 0 ) {

if ( $idletime{'start'} == 0 ) {
$idletime{'start'} = time();

$idletime{'end'} = time();

$idletime{'total'} = $idletime{'end'} - $idletime{'start'};


if ($idletime{'total'} > $processcount_cpuallowidletime ) {
$process_sleeptime = $process_sleeptime*2; # recalculate value of sleep time
if ($DEBUG > 0 ) {
syslog("debug", "A dormir durante ".$process_sleeptime." seconds...");
syslog("info", "Sleeping:".$process_sleeptime);

if ( ($processcount > 0 || $idletime{'total'} > $processcount_cpuallowtotalidletime) && $idletime{'start'} != 0 ) {

if ( $DEBUG > 0 ) {
syslog("debug", "fim Verificar idle time ".$processcount." ".$idletime{'total'}." ".$processcount_cpuallowidletime);

if ($process_sleeptime > $processcount_cpuallowtotalidletime ) {
$process_sleeptime = 1;

=item resetIdleTime()

Reset idle time counters


sub resetIdleTime {
$idletime{'start'} = 0;
$idletime{'end'} = 0;
$idletime{'total'} = 0;


GSM Decryption Published

“The NY Times reports that German encryption expert Karsten Nohl says that he has deciphered and published the 21-year-old GSM algorithm, the secret code used to encrypt most of the world’s digital mobile phone calls, in what he called an attempt to expose weaknesses in the security system used by about 3.5 billion of the 4.3 billion wireless connections across the globe. Others have cracked the A5/1 encryption technology used in GSM before, but their results have remained secret. ‘This shows that existing GSM security is inadequate,’ Nohl told about 600 people attending the Chaos Communication Congress. ‘We are trying to push operators to adopt better security measures for mobile phone calls.’ The GSM Association, the industry group based in London that devised the algorithm and represents wireless operators, called Mr. Nohl’s efforts illegal and said they overstated the security threat to wireless calls. ‘This is theoretically possible but practically unlikely,’ says Claire Cranton, a GSM spokeswoman, noting that no one else had broken the code since its adoption. ‘What he is doing would be illegal in Britain and the United States. To do this while supposedly being concerned about privacy is beyond me.’ Simon Bransfield-Garth, the chief executive of Cellcrypt, says Nohl’s efforts could put sophisticated mobile interception technology — limited to governments and intelligence agencies — within the reach of any reasonable well-funded criminal organization. ‘This will reduce the time to break a GSM call from weeks to hours,’ Bransfield-Garth says. ‘We expect as this further develops it will be reduced to minutes.'”

Esta conversa sobre ser ilegal quebrar o algoritmo GSM lembrou-me a conversa de Rob Savoye sobre o facto de não poder fazer Reverse Enginering aplicando “atalhos” e por isso demorar mais tempo a conseguir resultados. Mas no final tal como Nohl conseguiu desencriptar o GSM outros também o conseguirão é apenas preciso tempo e paciência.
A única preocupação de certas pessoas é que as falhas das quais certos governos(US) e organizações(NSA) se aproveitam lhes fujam ao controlo.

Linux Kernel the pain!!!

Sim, “the pain” neste caso precisei de várias opções no kernel para mais tarde não ter surpresas ou necessidade de o recompilar, mas realmente é doloroso o tempo que demora a recompilar.

JN e os Vírus

“Num primeiro momento o utilizador pode apenas notar uma certa lentidão no seu PC, mas o seu computador converte-se num foco de infecção.Para fazer face a esta falha de segurança, a Microsoft publicou em Outubro de 2008 uma forma de a corrigir que é possível instalar automaticamente através da Internet.

A terceira via de infecção do Conficker é através dos arquivos partilhados em rede pelas empresas.”

Para evitar esta forma de propagação basta ter um poderoso antivírus actualizado e e instalar o patch MS08-067 que a Microsoft disponibiliza na sua página.”

Resumindo para superar este vírus basta-me ter um poderoso anti-virus.