MySQL can’t start after updating from 5.1 to 5.5

After updating a MySQL server from 5.1.73 to 5.5.4 it won’t start. To see what was going on I checked the logs:

# tail /var/log/mysql.log
141221 13:23:41  InnoDB: Waiting for the background threads to start
141221 13:23:42 InnoDB: 5.5.41 started; log sequence number 1589339
141221 13:23:42 [ERROR] /usr/libexec/mysqld: unknown variable 'record_buffer=1M'
141221 13:23:42 [ERROR] Aborting

It was obvious that many things had changed form 5.1 to 5.5 and in this case the reason to the problem was that record_buffer has been deprecated and now it’s called read_buffer_size. Changing the name of it in /etc/my.cnf fixed the problem.

mysql

Fix “Clocksource tsc unstable” kernel message in a virtualized CentOS

If you use CentOS in a virtual environment it may be possible to get hundreds or messages like this from the kernel (using dmesg):

Clocksource tsc unstable (delta = -227342541 ns).  Enable clocksource failover by adding clocksource_failover kernel parameter.

clocksource_failover

First check which clocksources are available:

cat /sys/devices/system/clocksource/clocksource0/available_clocksource

And which is being used at the moment:

cat /sys/devices/system/clocksource/clocksource0/current_clocksource

Most probably CentOS is using tsc and it also will be available acpi_pm.

To fix the issue edit /etc/grub.conf and add to the kernel configuration line clocksource_failover=acpi_pm:

kernel /vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=/dev/mapper/vg_centos-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_centos/lv_swap  KEYBOARDTYPE=pc KEYTABLE=es rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_centos/lv_root rd_NO_DM rhgb quiet clocksource_failover=acpi_pm

Then reboot and the problem should be gone.

Fix The parameter “debug.error_handler.throw_at” must be defined in Symfony2

If you get this error when trying to clear a Symfony2 application cache:

$ php app/console cache:clear --env=prod --no-debug 


[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] The parameter "debug.error_handler.throw_at" must be defined.

This is the solution: delete the cache folder content and warmup de cache:

$ rm -rf app/cache/*
$ php app/console cache:warmup --env=prod

symfony-cache-clear

Ref: http://stackoverflow.com/a/27215486

How to fix no colors in Symfony2 Console Component

After updating from PHP 5.4 to PHP 5.6 I saw there was no colors anymore when running commands with the console component.

symfony-console-component-no-colors

This happend because I didn’t install php-poxis extension. So it was fixed by just running this Mac Ports command:

sudo ports install php56-poxis

symfony-console-component-with-colors

Note: If you use another version of PHP change the version number or just use php-poxis.

Ref: http://serverfault.com/a/409966

Can’t establish connection to MySQL after PHP upgrade

When you upgrade PHP there are chances that the new version is reading a different php.ini file than the previous version. You have to see which php.ini it’s reading (for example with phpinfo()) and then check that it has correctly configured the pdo_mysql.default_socket, mysql.default_socket and mysqli.default_socket options. They are probably empty:

pdo_mysql.default_socket =
mysql.default_socket =
mysqli.default_socket =

And they should have something like this:

pdo_mysql.default_socket = /opt/local/var/run/mysql55/mysqld.sock
mysql.default_socket = /opt/local/var/run/mysql55/mysqld.sock
mysqli.default_socket = /opt/local/var/run/mysql55/mysqld.sock

mysql