Amazon Lambda with PHP - php

I have a database (MySQL) created in Amazon RDS. Also created a PHP class for connecting to that database and which will return some webservice as JSON format according to the request. Which I am using for my mobile and Angular applications.
Currently I am hosting that php file in one of my GoDaddy server and calling that PHP file from the app(s).
My question is - can I use AWS Lambda for this purpose (for deploying php file ) ? In some tutorials I found Lambda will not support PHP.
The PHP file serves the following functionalities
Creating various JSON files from MySQL table.
Uploading images to Amazon S3 bucket.
Sending push notifications (FCM) to Android / iOS devices.

AWS Lambda currently does not support PHP.
You could use any one of the supported languages for your purpose.
For push notifications you could use SNS
Read more: https://aws.amazon.com/lambda/faqs/

Related

php Api hosted on AWS s3 bucket

I wanna host a php file that retrieve data from a mysql DB how ever aws is not authorizing POST method.
I need to know how can I add the code in PHP knowing I already configured the Bucket policy and CORS
You can only serve static content from an S3 - PHP will not be processed.
If you want to set up a dynamic PHP website on AWS have a look at LightSail and its LAMP stack.
You should try Amazon API Gateway.

Can files be uploaded to a compute engine on GCP using an application page written in php/html?

Can we upload image files to a GCP running compute engine directly using PHP?
I know that it can be done using the backend ssh on GCP.
I have a solution that works in my local system to upload files but does not work on GCP.
Based on initial research it appears that GCP does not allow file upload directly.
Need confirmation though or if there is a way in which file upload can work, please enlighten.
I do not think it can be done directly through php, through ssh yes.
You can upload files with PHP.
If you want to upload to the server local disk, things become a bit simpler. Just ensure you have PHP configured for upload: PHP File Upload
If you want to upload to Google Storage, say to a bucket, you'd need to authenticate and get access there. Google Cloud SDK can provide this. Then you can install API Client Libraries for PHP and optional Cloud SDK components. That way you might call gcloud shell command or use API. Cloud SDK will provide transparent connection and authentication for you so that you can upload to the Google Storage.
Please see:
Cloud SDK
Google API Client Libraries

Sending data to aws using api

I need to send an image to aws using an API in PHP. The image comes from the webcam, I have set up the aws as well, the backend neural network on aws is in python. I need to directly take the image I get from the webcam and send it to the backend and the neural network should start processing the image. How do I write an API call to the backend? And how do I start the backend code in one swift flow, without having to run the backend separately?
in aws beckend which aws you are using please speify your so other can understand and suggest you path as per it.
you can do one thing upload image to s3 and trigger lambda if image uploaded to s3 using lambda you can trigger other services. if you are using lambda as beckend service then it will easy
https://docs.aws.amazon.com/lambda/latest/dg/with-s3.html
.

PHP via Amazon S3 for Android App

I have developed an Android app which does a GET/PUT operations with a test web server for fetching and storing data in JSON format. For PUT using a PHP script on webserver via parameters in url. Now to scale the solution, i am exploring AWS solutions. How to achieve PHP script based logic handling on webserver with AWS S3 or any other cloud based storage which can perform this php based logic handling.
I would recommend to use AWS Lambda- It doesn't need servers to be hosted and maintained, which is a big headache. With AWS Lambda, in few minutes you can get your web application running. Your PHP scripts can be hosted as service and AWS will take care of its scalability and availability.
https://www.youtube.com/watch?v=eOBq__h4OJ4
https://aws.amazon.com/serverless/build-a-web-app/
https://aws.amazon.com/blogs/compute/scripting-languages-for-aws-lambda-running-php-ruby-and-go/
AWS S3 you can use for storing your static files like images, css, javascript etc...

Parse: upload PHP files

I am new to using Parse and am developing an app using it as a backend. I want to also use it to develop a portal that would access data submitted from the mobile app.
Can I use Parse Cloud Code to upload my PHP files there (developed using PHP SDK)? Or should I upload it to another hosting provider and connect to Parse?
In the docs, it states I can use javascript library there but didn't catch anything about PHP SDK files uploaded and accessed from there.
Thanks,
No you can't, Cloud Code only supports JavaScript. If you want to use PHP for server-side logic (beforeSave triggers for example), look into using Webhooks which will hit an endpoint on a server specified by you (see https://www.parse.com/docs/js/guide#cloud-code-advanced-cloud-code-webhooks)
If you are looking into hosting some sort of frontend on Parse (for example an admin area) then your only option is JavaScript, see https://www.parse.com/docs/js/guide#hosting

Categories