appengine-php-sdk
appengine-php-sdk copied to clipboard
Response size on PHP 8.2
I found a bug while using Laravel on PHP 8.2 runtime environment, but it also occurs without a framework. I've managed to reproduce the bug.
My index.php is as follows:
<?php
$size = (int) $_GET['size'];
$chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
header('Content-type: application/json');
echo '{"result": "' . str_shuffle(substr(str_repeat($chars, (int) ($size / strlen($chars)) + 1), 0, $size)) . '"}';
My app.yaml is as follows:
service: php82bigsizebug
runtime: php82
entrypoint: serve index.php
If I run:
https://php82bigsizebug-dot-my-gcloud-project.appspot.com/?size=1000
it responds immediately.
If I run:
https://php82bigsizebug-dot-my-gcloud-project.appspot.com/?size=1000000
it runs indefinitely. It responds after 600s (google cloud timeout) with the error:
Error: Server Error
The server encountered an error and could not complete your request.
Please try again in 30 seconds.
And in the logs I have the following error:
Process terminated because the request deadline was exceeded. Please ensure that your HTTP server is listening for requests on 0.0.0.0 and on the port defined by the PORT environment variable. (Error code 123)
On PHP 8.1 runtime it responds immediately on both cases. So, if I change my app.yaml to:
service: php82bigsizebug
runtime: php81
entrypoint: serve index.php
it runs as expected.
Yes, this problem is completely correct, I also encountered a similar situation and could not solve my problem. Therefore, I downgraded to 8.1 and my problem was solved.
Thank you @luismonge79 ! I confirm that downgrading from php83
to php81
worked for me.
I've been trying to figure out what could possibly be wrong with my app and it turns out it's not my fault at all. I am wondering if there's some kind of tweak we could do in app.yml
or php.ini
in order to avoid this? 🤔
Either way, this needs to be scaled. Please Google Cloud, take a look at this!
Hello everyone! Just tested it again with php82 and php83 on the app.yaml and it's working great. Thanks to whoever fixed it. Closed issue.