Posted by scotti3g
Had a beauty today. There I was ready to deploy some nicely polished code to the server. After some thorough local testing it looked like it’d be a smooth process. So the code went up, but all my funky AJAX stuff stopped working on the server. How could that be? It was perfect locally… :)
It took a little while but in the end I realised what was going on – json_encode wasn’t working. The server was running PHP 5.1.6 and json_encode only became “standard” with PHP 5.2.0 onward.
I needed a solution fast. No time to recompile a newer version of PHP, add libraries or anything fancy like that. I just needed the function json_encode to work right now. Thankfully, the solution was as easy as adding replacement a function a user kindly submitted from the PHP site itself:
http://au.php.net/manual/en/function.json-encode.php#82904
I blindly assumed PHP 5 was PHP 5. I wasn’t using any extremely fancy commands or anything, but I still came unstuck. So the moral of today is check your server specification right down to every last decimal point! ;)
thanks for the link, i was having the same problem.
Thanks for the link. I got spoiled using json_encode and then had to go back to another project that has to work on older versions of PHP.
Thanks – me too:) Weird thing is that it gives you a nice 200 OK response with nothing in it.
It would have been better if you had copied that source code on your blog (but still leave the URL to where you find it – for purposes of giving credit where credit is due).
I want to that link and was not able to locate item/post #82904 making this post moot.
Link changed to
http://au.php.net/manual/en/fu.....php#100835
sggdfgfgdfg
Thanks for the Link. it solved my problem
THANKS A LOT! I was making me crazy. Works perfectly