I wrote my first functional PHP webapp called Heater. It features interactive calendars using the Google Chart and AWS Redshift backend .
Now that it works for me, I started to improve performance. I installed APC and confirmed that it works.
My question is: how do I enable request caching before Redshift?
Here is an example of how I am loading data now:
getRsData.php:
<?php
$id=$_GET["id"];
$action=$_GET["action"];
$connect = $rec = "";
$connect = pg_connect('host=myredshift.redshift.amazonaws.com port=5439 dbname=mydbname user=dmourati password=mypasword');
if ($action == "upload")
$rec = pg_query($connect,"SELECT date,SUM(upload_count) as upload_count from dwh.mytable where enterprise_id='$id' GROUP BY date");
...
?>
> 5 , . , . Redshift APC cron ( ) , . script .
. Google, , , . AWS Linux PHP 5.3 apc-3.1.15.
.
EDIT,
if (!preg_match("/^[0-9]*$/",$id)) {
$idErr = "Only numbers allowed";
}
if (empty($_GET["action"])) {
$actionErr = "Action is required";
} else {
$action = test_input($action);
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}