I was trying to run ‘pear’ but I accidentally typed ‘pair’ and got command not found even though I knew ‘php-pear’ was installed. Traps for young players! I bet I’m not the last person to make that mistake…
Tag Archives: php
What is PEAR?
Today I read What is PEAR? — it talks about PEAR (PHP Extension and Application Repository) and its relationship to PECL (PHP Extension Community Library).
Amazon Web Services (AWS) — Elastic Compute Cloud (EC2)
Learning how to program the EC2 system via the PHP API. I needed to know about RunInstances and AssociateAddress.
You can send Amazon a Request to Remove Email Sending Limitations which by default limit the amount of email traffic instances can process.
Also read about Amazon EC2 Instance IP Addressing and Elastic IP Addresses (EIP).
Although I settled on using the PHP SDK I read the doco for the Java SDK EC2 client: Class AmazonEC2Client. The corresponding PHP API is here. Also How to get list of EC2 instances with Amazon PHP SDK 2 from StackOverflow was useful. All AWS SDKs are here and there are command-line tools. There is AWS SDK for PHP Documentation. This article Provision an Amazon EC2 Instance with PHP was a handy starting place. I also saw the Amazon Elastic Compute Cloud API Reference. I also read AWS SDK for PHP: Run an Amazon EC2 Instance.
I started a project at ProgClub called make-love, which is my server re-instantiation script. It shows how to use the AWS PHP SDK and the r53.php code for programming AWS Route53 DNS services. Documentation on the Route53 client can be found at Ordering Disorder. More on r53.php at SourceForge. I added a new function listAllResourceRecordSets to the Route32 class and commented out some SSL validation code because validation was failing and it’s no big deal to ignore it.
Printing PHP Call Stack
Discovered how to print a call stack in PHP from a StackOverflow article listing $ex->getTraceAsString().
PHP curl_exec
Today I learned about curl_exec which is a HTTP client for use in PHP.
Using Phar Archives: Introduction
Read a little bit about Using Phar Archives today.
Extracting files from .phar archive
Today I learned about Extracting files from .phar archive although I haven’t actually done it successfully yet.
PHP filter_input_array
On my TODO list is reading about the PHP filter_input_array.
PHP http_build_query
Using http_build_query now that I know about it! Handy!
Escaping SQL values in PHP without using mysql_real_escape_string
Found this article which has a handy ‘escape’ function:
// replace any non-ascii character with its hex code. function escape($value) { $return = ''; for($i = 0; $i < strlen($value); ++$i) { $char = $value[$i]; $ord = ord($char); if($char !== "'" && $char !== "\"" && $char !== '\\' && $ord >= 32 && $ord <= 126) $return .= $char; else $return .= '\\x' . dechex($ord); } return $return; }