Setup postgreSQL RDS using Ansible

Setting up PostgreSQL on RDS using ansible is a bit tricky because the main user on RDS is not a SUPERUSER and roles membership is not automatically granted for ex: “ERROR: must be member of role ..” is quite common. Here is a working solution:

Fix W3 Total Cache W3_Plugin_TotalCache::ob_callback() expected to be a reference

Around a year ago I was playing with W3 Total Cache plugin on HHVM while I got an annoying warning

Warning: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /wp-includes/functions.php on line 3269

The funny part is that one of the functions was passing by reference which I still could not find the reason for it, maybe it was a limitation in PHP 4.3. Removing one character “&” fixed the issue so I submitted a pull request to the author although the repository currently does not accept pull request. Later on as PHP 7.0 was released, the issue started to show on PHP as well which brought more attention to this small fix. The users comments included anger such as user @kmob2 who said

this is becoming a running gag

Even more user @pratham2003 proposed a one line bash command to solve the problem

sed -i.bak 's/function ob_callback(&/function ob_callback(/g' /path/to/public_html/wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php

I hope that the developers will finally listen to the users and fix it soon!

Configuring vsFTPd on CentOS with different port

Check Installing CentOS 6.2 on VMware post.

– make sure SELINUX is disabled and iptables is configured for FTP

– add ftp user

adduser ftpuser -g ftp -s /sbin/nologin -d /server
#set password
passwd ftpuser

– configuration, more info

increase linux file descriptors

Check Installing CentOS 6.2 on VMware and mounting partitions with noatime posts.

This is very important performance tuning for any web server more information here

#adduser www first
ulimit -n unlimited - www
#check default number of concurrently open file descriptors 
cat /proc/sys/fs/file-max
#set the number to high value depending on server config
echo '1773914' > /proc/sys/fs/file-max
echo 'fs.file-max=1773914' >> /etc/sysctl.conf
/sbin/sysctl -w fs.file-max=1773914