Created
October 22, 2015 00:47
-
-
Save oh-sky/1b101ec897cf06136cf1 to your computer and use it in GitHub Desktop.
aws-lambda-hello-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Hello world.\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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