Fix rtrim to trim to allow use with php-fpm