Archive for the ‘php’ Category

apach configuration

January 22, 2015 Leave a comment

Categories: apache, aws, cakePhp, linux, php, Web

install php mysql apache and secure mysql at ec2 instance

October 14, 2014 Leave a comment

Categories: aws, linux, MYSQL, php, Web

MAP REDUCE using couchdb

February 18, 2014 Leave a comment

  • If you don’t use the key field in the map function, you are probably doing it wrong.
  • If you are trying to make a list of values unique in the reduce functions, you are probably doing it wrong.
  • If you don’t reduce your values to a single scalar value or a small fixed-sized object or array with a fixed number of scalar values of small sizes, you are probably doing it wrong.

AWS: pcre lib conflict with

July 27, 2012 Leave a comment

Severity: Warning –> preg_match(): Compilation failed: unknown option bit(s) set at offset 0
restarted apache

upgraded “*php*”

and rebooted the instance



Please make sure you are using the latest version of pcre with the latest version of PHP. You can ensure both are up to date by running

sudo yum upgrade '*php*' pcre

Once everything has been updated please restart you web server through the init script for Apache HTTPD this can be done by doing

sudo service httpd restart
Categories: php, Software Engineering, Web Tags: , ,

Amazon Web Services : Cloud Watch API

July 18, 2012 Leave a comment

get_metric_statistics :  sdk php 1.5.10

  1. $cw = new AmazonCloudWatch();
  2. $instance_id1 = “x-xxxxxx”;  // give you instance id for which you want to fetch statistics
  3. $instance_id1 = “x-xxxxxx”;  // give you instance id for which you want to fetch statistics
  4. $opts = array(“Dimensions” => array());
  5. $member = array(“Name” => “InstanceId”,”Value” => $instance_id1);
  6. array_push($opts[“Dimensions”], $member);
  7. $member = array(“Name” => “InstanceId”,”Value” => $instance_id2);
  8. array_push($opts[“Dimensions”], $member);
  9. $data = $cw->get_metric_statistics(‘AWS/EC2’, ‘CPUUtilization’, ‘-1 day’, ‘now’, ‘300’, array(‘Average’), ‘Percent’ ,$opts);

mailto using javascript

February 21, 2011 Leave a comment

some time it is required to set mailto using javascript.

let us write a JavaScript function this.

<script type=”text/javascript”>

function sendmail() { var user=”apps”; var domain=””;      document.location=”mailto:”+user+”@”+domain;     }


now you can call this function using any event or method lets suppose we use onclick event of an div.

<div id=”click-me” name=”click-me” onclick=”sendmail()”>click me </div>

Voila, it opened my outlook.

Array to String Conversion using php

January 21, 2011 1 comment

it normally happen you are convert  some delimited string to array and php do it as using “explode()”

array explode ( string $delimiter , string $string [, int $limit ] )

php also provide the facility to convert array to string and most commonly used method is “implode”

string implode ( string $glue , array $pieces )

e.g lets we have an array of student names and we want to print  Read more…