Redhat / Centos LAMP Setup Guide

If you're setting up a RedHat or Centos server from a VPS server without a control panel, setting up a LAMP (Linux, Apache, MySQL, and PHP) can be a nuisance. Here is a basic setup guide for bringing your Linux server to the LAMP development environment.

One of our WordPress websites was running very slow, so I have been asked to diagnose the application. The website was running in upwards of 6 seconds to load the homepage, and 8+ seconds to load woocommerce product pages. There are several debugging and profiling tools available in the PHP realm, and Xdebug is an excellent choice. New Relic (free and premium versions) is another choice for profiling and debugging PHP applications.

Ksh/Bash Change Directory commands

When you're working in the command-line interface, you may be going deep inside the directories, and moving back and forth between those directories can be a nuisance. There are built-in directory commands in ksh/bash that you can use to ease your change directory (cd) pain.

We have a VPS server running Magento flawlessly for nearly a year. The filesystem has been completely filled with mails queued in clientmqueue, and MySQL can't add more data causing the website to halt. Sendmail was running fine, but we've had a difficult time deleting files residing in /var/spool/clientmqueue folder. The following commands failed:

As a web host, we needed an automated mechanism for generating snapshots of server filesystems on the Linux-based systems. There are a number of ways to achieve backups on Linux systems including Remote backup using Linux tar/ssh/cron and incremental tar backups on a local file system. One of the drawbacks of using tar to perform an entire filesystem backup is that some systems do not have the ability to create a compressed tarball greater than 2GB in size.

How to change the date.timezone in Linux/PHP?

If your date.timezone is not properly set, your web application will not display your local time correctly. The default date.timezone will be set to the server time zone. If you (or your company) are located in a different time zone from the server, you may have to override the value in your PHP application. The date.timezone can be set at the system level, PHP level, or application level.

How to mitigate from Apache Killer?

Apache is the most popular web server being used today. Apache Killer exploit which was released in August 2011, exploits a vulnerability in the Apache software by sending a crafted "Range" HTTP header. Apache Killer attack abuses the HTTP protocol by requesting URL content to be returned in a huge number of small chunks, which leads to hundreds of large memory fetches causing a server to run out of memory and crash. This vulnerability identified as CVE-2011-3192 was fixed in httpd-2.2.21.