skip to Main Content
+971 55 881 1725 hmimthiaz @ imthi.com

WHM / cPanel – Compile PHP 5.3 to work with PHP 5.2

This is one of major issue lot of web masters face now. As PHP 5.2 has reached end of life we are forced to seek options to migrate and test PHP applications in PHP 5.2 and 5.3. Raj COO from WebHostRepo.com has posted a nice blog post on how to achieve this.

Running PHP 5.3 along with PHP 5.2.x in cPanel servers.webhostrepo

I did all the steps as mentioned on the blog post except for one, I had a lengthier configure statement 😉

Install ZendGuardLoader

Edit /usr/local/php53/lib/php.ini and add these lines to end

Happy migration 😉

Compile PHP 5.3.19 on CentOS 6.3 with Curl 7.28

new-php-logo

For this installation I choose CentOS 6.3 minimal version. You can download the ISO from the mirrors or direct download it from SYNc yourself. Once the CentOS installation is completed make sure you are connected to Internet to update the latest libraries.

 

Note: These steps are done assuming you are logged in as root user

1. Please update the available updates for the OS and restart

2. Install EPEL (Extra Packages for Enterprise Linux) so that you can get all the needed libraries for compiling PHP

3. Install Development Tools – Detailed User Guide

4. Install MySQL Database client

5. Install the following libraries which are required for different modules in PHP. Please make sure all the dependencies are met before installation

6. For this installation I planned to use the latest version of curl so I had to my custom curl compilation

7. Download and compile PHP 5.3.19

8. Copy php.ini

9. Edit Apache conf check if “LoadModule” is present else add it.

LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so

10. Set handler for Apache to handle PHP files

11. If you are not planning to install ZendGuardLoader skip to step 13 else make sure you have disabled SElinux. Detailed instructions

12. Install ZendGuardLoader

Edit /usr/local/php-5.3.19/lib/php.ini and add these lines to end

13. Restart you apache and you are set

It took a great deal of time to make this work and with lot of trial and errors. If anyone finds a better way to compile please do share it with me. All the best 😉

AWS – Adding extra EBS volume to your EC2 instance

When you boot an Amazon Linux EC2 instance it boots with a 8GB EBS volume. If you need more space you need to add additional drives. For this you need to use EBS volumes.

Before you start the process please have look at the current partition blocks loaded in your server. You can do so using the contents of partition file.

Now you goto EBS volume manager in AWS console and create a new volume, make sure the zone is the same in which your EC2 instance is running.

Once the volume is created you need to attach this to an instance. You can right click on the created volume and say attach. Select the instance then device will populate automatically, you can either leave it or change if you need specific device name.

Now check the partition file again. You can see a new device being added.

The volume attached is not ready for use. It is like a new hard disk. You need to partition and format the same. In our case I am going to use the full disk as one partition. So I am going to skip the fdisk setup and jumping right into formatting the volume.

The format process can take few seconds just be patient. The drive is ready to use, and to do the same we need mount it.

If you wish this device to mount automatically when you reboot the server make sure you add this to your fstab file.

When I started which Amazon Cloud, I found these things in a hard way, hope this can help someone 🙂

Apache Log Format for Amazon EC2 with Elastic Load Balancer

The journey through the Amazon Cloud (AWS) is quite amazing. Recently I had to use two EC2 instance with Elastic Load balancer. Once the website was served with load balancer only the load balancer IP was logged as remote IP.

After Googling for few hour and with trial and error method I got the correct Apache log format so that the real remote IP is logged.

I created a custom log format with a name “combined_new” and used it in all the virtual host configured in Apache. But you can use the format however you want.

Before you make any changes to httpd.conf please go through Apache log module.

I hope this small tip helps 😉

Note: Always backup your original httpd.conf before you make any changes.

Download & Process Amazon Cloudfront Logs with Awstats

These days we use Amazon Cloudfront for content delivery. Amazon has made it very easy to deliver files in a Amazon Simple Storage Service (S3) bucket using Amazon Cloudfront distribution. If you are using Cloudfront as Content Delivery Network (CDN) your next task will be monitoring the usage. For this Amazon Cloudfront has a provision to store access logs to a S3 bucket. My hurdle was to process the log files stored by Cloudfront. For sites hosted with apache I use Awstats for reading the logs. So my vote was for awstats. Please follow the steps one by one 😉

1. Need to download the log files stored in the S3 bucket. For this I had to use the a python script done by wpstorm.net but I had to make some modification so that it worked for me. Please follow the blog post if you need any help setting up the required libraries.

get-aws-logs.py

Note: The above script will download the s3 logs to specified folder. Please make sure you put your Amazon access keys.

2. Now we have bash script which will uses the above python script to download the log files and combine all of them into a single log file and then it will be analyzed by awstats.

Warning: Please read through the script files and make necessary changes needed.
Note: You should have awstats installed on your system. The bellow script uses awstats.
Note: You can download the script files at the end of this blog post where awstats configuration with custom setup for cloudfront log format is also provided.

get-aws-logs.sh

I would suggest you to test run the above scripts on a staging / testing environment before moving to a production. Again please change the scripts with your domain details and Amazon access keys.

Download the scripts to download and process Amazon Cloudfront Logs with Awstats.

Have a nice journey exploring the cloud 😉

Back To Top