I'm trying to run a php script in aws lambda using python runtime. I tried using python os.system module to call the php page to execute the script. The code is given below
import os
def lambda_handler(event, context):
os.system("php /home/admin/web/####/###.php")
On running the above code, it displays error: "sh: php: command not found". I do not have much knowledge either in python scripting or shell scripting. So any help would be much appreciated.
Update: New code
def lambda_handler(event, context):
stream = os.popen("/usr/bin/php /home/admin/web/path/")
output = stream.read()
print(output)
Used the new code but its displaying this error now: /bin/sh: /usr/bin/php74: No such file or directory.
I don't understand, because php is installed into the system , but yet it is telling no such file exists.