简体   繁体   中英

AWS Lambda php spawn EACCESS

I've been stuck for quite some time now and I looked through similar posts here and what I have managed to google.

My goal is to run a PHP function on lambda, nothing fancy, I just followed all the steps as laid out in here https://aws.amazon.com/blogs/compute/scripting-languages-for-aws-lambda-running-php-ruby-and-go/

Error message I get when i run test is:

{
    "errorMessage": "RequestId: 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc Process exited before completing request"
}

And log is :

START RequestId: 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc Version: $LATEST
2018-11-14T10:17:39.019Z 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc Error: spawn EACCES

    at _errnoException (util.js:1022:11)
    at ChildProcess.spawn (internal/child_process.js:323:11)
    at exports.spawn (child_process.js:502:9)
    at exports.handler (/var/task/php.js:8:15)
END RequestId: 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc
REPORT RequestId: 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc  Duration: 56.44 ms  Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 20 MB  RequestId: 832ee5e0-e7f6-11e8-bde8-b7d0d5da71bc Process exited before completing request

So as I thought the problem was that ('Error: spawn EACCES') permissions on binaries after i zip it on my windows 10 machine were missing so i tried adding zip to my git-bash and zip with it zip -r lambda.zip php-7-bin php.js helloLambda.php but it did not work either.

And now I am out of ideas, thinking maybe someone else might know what's wrong.

I made it work. Created both php.js and helloLambda.php on ec2 instance (with nano) like PHP binary and zip'ed em in that environment. After that I downloaded .zip to my windows machine and uploaded it to lambda function.

Too bad they don't mention (in amazon tutorial) that creating files on windows doesn not give them needed permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM