I have 3Mb string data in mysql column. When I run a SQL query at mysql prompt it returns complete data. But from php I am unable to fetch complete data, it is returning only 1mb of data data.
my mysql configs have max_allowed_packet_size=33554432
PHP max_post_size=30mb
and memory_limit=300mb
Are you using PDO?
The problem may be that the insert buffer default value is 1MiB.
To change it, update the line used to connect to the database by adding the new value for the parameter MYSQL_ATTR_MAX_BUFFER_SIZE
:
$pdo = new PDO("your connection_settings", "user", "pass", array(PDO::MYSQL_ATTR_MAX_BUFFER_SIZE=>1024*1024*5));
In this example, the new size of the buffer will be 5MiB.
See this page for more information about this attribute.