PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away:

Category: Note to Self

This error started to happen on a Drupal site I was developing on my development  machine (Fedora)

It’s apparently a problem with the ‘maximum allowed packets’ size in the Mysql configuration

To check the default value:

mysqladmin variables

Look at the value of max_allowed_packet, on my system the default is 1MB

SOLUTION

Increase to 100MB:

Edit mysql config error e.g  /etc/my.cfg and add  line:

max_allowed_packet=100M

then restart mysql

sudo service mysqld restart

Problem solved!

Drush – Getting remote sessions to work

Category: Note to Self

Getting Drush remote sessions working between development machine and hosting

By default aliases are not expanded when the shell is not interactive, unless the expand_aliases shell option is set:

On remotely hosted server (Staging Server)

 edit ~.bashrc

Example:

# .bashrc
# aliases not usually expanded in non interactive shells, so fix this:
shopt -s expand_aliases
 
# Source global definitions
if [ -f /etc/bashrc ]; then
  . /etc/bashrc
fi 
 
# User specific aliases and functions
alias drush="/home/admin98/drush/drush"