There’s no clarity though, the variables are still vastly different.
Massive gulf there in possible problems.
get-collections.php in the terminal is not Index.php in the browser.
Ignore the ajax ,Add logging in php , confirm the source server logic works.
Then go back to ajax, then of course rule out browser , check different browsers, devices, etc.
And inspect the network response in browser dev tools.