We're facing a vital problem with BLOBs being retrieved from MySQL DB using PHP and sent with the firewall. Same PHP code works fine once the DB is hit from localhost skipping the net tier.
To elaborate the problem -
We've BLOBs saved within the MySQL DB that are retrieved using simple PHP code which works fine on Godaddy Hosting That Is Shared. We lately gone to live in Amazon . com EC2 / RDS where fire walls are setup and that we are realizing this problem the PHP code retrieves correct BLOB but junk BLOB information is received using the response which comes from Apache through fire walls. Exactly the same code when connects straight to RDS and pulls exactly the same BLOB it's retrieved and displayed all right.
The code that stores the BLOB within the database has labored before and works fine now because the images being saved could be directly utilized using DB Connect.
I'm so lost on that one why once the BLOBs emerge with the web server as part of the response just shows junk. I've attempted adding headers etc. and everything nothing works once the fact is with the Web Servers. I do not think the problem is by using the PHP code that stores and retrieves the BLOBs back and forth from MySQL.
Will there be a firewall configurations or Apache config on EC2 that may corrupt the BLOB data being sent? Help.
From that which you publish inside your question this appears like an encoding problem between your database client (your webserver) and also the database server (amazon . com EC2). Just double-look into the database client and server configurations and be sure that the data saved inside the database is properly encoded too.
I write so since the query will get through, just the BLOB data get's mangled. So this doesn't seem like a firewall problem in my experience.
More details and links can be found in the similar issue.
WOW!! It was a difficult nut to hack however , incredible this can screw up a functional codebase.
During my PHP code that retrieves the BLOB I'd the db connect string that we changed by having an include "DBCon.corporation" and that i place the db qualifications for the reason that file.
You know what...the DBCon.corporation file had two blank lines or something like that like this inside it prior to the PHP finish ?>
Therefore the reaction to the Have that responds using the BLOB was getting appended using the two blank lines and also the BLOB data was getting screwed up and also the browser was the inability to render the look any longer.
Removed the blanks within this file and Voila!! everything works just like it did before.