0

tried implementing a json query in a legacy PHP project:

SELECT JSON_ARRAYAGG(JSON_OBJECT(
'id', x.id,
'on_date', x.from_date,
'off_date', x.to_date,
'vessel', x.vessel_name,
'vessel_type', x.name
))
from service_list x where 1=1

and discovered that it's not working for unknown reasons. Mysql log clearly says "[Note] Aborted connection 28 to db: 'aaa' user: 'bbb' host: 'localhost' (Got an error writing communication packets)"

This is JSON_ARRAYAGG/JSON_OBJECT related issue, any queries work OK until I add JSON functions to query.

Working with MySQL directly also works, problem takes place only working with PHP.

I'm using the mysqli. I've already tried increasing the max_allowed_packet property in my.ini without any success. Please help.

dayan
  • 403
  • 1
  • 4
  • 12
  • run the query on the server directly and you will probably notice hat it takes too long, because you let **all data** being aggregated. you can check the timeouts and increase them properly – nbk Oct 26 '20 at 00:29
  • It works directly and remotely. It doesn’t work with PHP – dayan Oct 26 '20 at 07:48
  • php has its own timeouts https://stackoverflow.com/questions/3829403/how-to-increase-the-execution-timeout-in-php – nbk Oct 26 '20 at 11:02
  • Not sure it is timeout related. It breaks even when I select empty data as soon as query includes JSON functions – dayan Oct 26 '20 at 17:05
  • When you have increased all timeout, you should enable the general log and see how long everything takes, there is not that many things you can do increase the three timeouts in mysql and php – nbk Oct 26 '20 at 17:10

0 Answers0