DEV Community

Discussion on: The day our web server reached 100% capacity 💾

Collapse
 
dmahely profile image
Doaa Mahely

Hi there, you're right on us not having a dedicated devOps person as it is a small startup.
The amount of emails was huge and after going through a number of them, I noticed one cron job's response was adding backslashes, the number of which increased exponentially with each email. It reached a point where the entire screen was just filled with backslashes. The cron job's output wasn't incorrect, it was just being parsed incorrectly.

This Stack Overflow answer explains the root cause better:

Why is json_encode adding backslashes?

51

I've been using json_encode for a long time, and I've not had any problems so far Now I'm working with a upload script and I try to return some JSON data after file upload.

I have the following code:

print_r($result); // <-- This is an associative array
echo json_encode($result); //
…