Skip to content Skip to sidebar Skip to footer

Python Subprocess Popen Does Not Execute Php Script

Please note, we are using aws-lambda to execute a php script using python subprocess popen function. We used the following code to call the file in python popen: import json import

Solution 1:

AWS lambda environment will expire as soon as the handler method you defined returns, thus running background scripts/processes in your lambda environment directly is not possible. You can work around this issue by manually waiting for some time after you call the PHP script:

proc = subprocess.Popen(cmd, shell=True,stdout = subprocess.PIPE, stderr = subprocess.PIPE)
# wait for your subprocess to complete
time.sleep(10)
script_response = proc.stdout.read(); 

Post a Comment for "Python Subprocess Popen Does Not Execute Php Script"