I have tried several times to print a string by using the "echo" method but it seems to throw a 502 Bad Gateway when the string gets too large?
I'm using the PhpStorm's built-in webserver.
Does anyone knows how to fix this issue or could provide a workaround?
I have tried using multiple strings and apparently only short ones are giving me a 200 response.
The sever throws a 502 in the example below, but if I remove the part "\"maths\" ..... closing bracket or anything else to make it much shorter it gives back a 200. This includes non-JSON strings as well.
<?php
header("Content-Type:application/json");
echo "{
\"quiz\": {
\"sport\": {
\"q1\": {
\"question\": \"Which one is correct team name in NBA?\",
\"options\": [
\"New York Bulls\",
\"Los Angeles Kings\",
\"Golden State Warriros\",
\"Huston Rocket\"
],
\"answer\": \"Huston Rocket\"
}
},
\"maths\": {
\"q1\": {
\"question\": \"5 + 7 = ?\",
\"options\": [
\"10\",
\"11\",
\"12\",
\"13\"
],
\"answer\": \"12\"
},
\"q2\": {
\"question\": \"12 - 8 = ?\",
\"options\": [
\"1\",
\"2\",
\"3\",
\"4\"
],
\"answer\": \"4\"
}
}
}
}";
I couldn't find any error logs. The only thing that shows when the string is too large is a 502 Bad Gateway.