Skip to content

Instantly share code, notes, and snippets.

@oh-sky oh-sky/hello.php
Created Oct 22, 2015

Embed
What would you like to do?
aws-lambda-hello-php
<?php
echo "Hello world.\n";
exports.handler = function(event, context) {
var exec = require('child_process').exec;
exec('sh script.sh', function (error, stdout, stderr) {
if(stdout){
console.log('stdout: ' + stdout);
}
if(stderr){
console.log('stderr: ' + stderr);
}
if (error !== null) {
console.log('Exec error: ' + error);
}
context.succeed(stdout);
});
};
#!/bin/sh
cp php /tmp/php
chmod a+x /tmp/php
mkdir /tmp/lib
cp lib/libedit.so.0 /tmp/lib/libedit.so.0
export LD_LIBRARY_PATH=/tmp/lib:$LD_LIBRARY_PATH
/tmp/php hello.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.