We are facing a critical issue with BLOBs being retrieved from MySQL DB using PHP and transmitted through the firewall. Same PHP code works fine when the DB is hit directly from localhost bypassing the web tier.
To elaborate the issue -
We have BLOBs stored in the MySQL DB which are retrieved using simple PHP code which works fine on Godaddy Shared Hosting. We recently moved to Amazon EC2 / RDS where firewalls are setup and we are noticing this issue that the PHP code retrieves correct BLOB but junk BLOB data is received with the response that comes from Apache through firewalls. The same code when connects directly to RDS and pulls the same BLOB it is retrieved and displayed just fine.
The code that stores the BLOB in the database has worked before and works fine now since the images being stored can be directly accessed using DB Connect.
I am so lost on this one as to why when the BLOBs come out through the web server as a part of the response just shows junk. I have tried adding headers etc. and everything nothing works when the response is through the Web Servers. I don't think the issue is with the PHP code that stores and retrieves the BLOBs to and from MySQL.
Can there be a firewall settings or Apache config on EC2 that can corrupt the BLOB data being transmitted? Please help.