Derleek Posted February 18, 2010 Share Posted February 18, 2010 Hi, I am developing on a server that I don't really have all that control over... I just started working for a Kiosk company about 3 months ago. I am used to developing on my localhost (MAMP) and porting it to my hosting company. I recently wrote a script that takes advantage of json_decode() and it appears the server I am working on does not support this method... Fatal error: Call to undefined function json_decode() in /var/www/html/scripts/generate_excel.php on line 25 I looked in phpinfo() and on my localhost it has "json support" whereas on this server there is no mention of json in the phpinfo(). The php versions are slightly different... 5.1.6 (json not working) Vs. 5.2.10 (json working) Was json support added between those versions? What do I need to get json_decode()/json_encode() working on this server @ work? Not all that good at this kind of stuff, I try to stay away from configuring anything and just stick to the code when I can... Thanks Quote Link to comment Share on other sites More sharing options...
salathe Posted February 18, 2010 Share Posted February 18, 2010 json_encode was only added to the PHP core in 5.2.0. You can* install the json PECL package (http://pecl.php.net/package/json) but it would be advised to push your client into upgrading their super-duper-old version of PHP to something more recent (with many hundreds of security and bug fixes). * if you cannot even add pecl extensions, push even harder for an upgrade... tell them you can't do your job with that rubbish old version. [ot]Generally the PHP manual displays the version information at the top of the page for each function: http://php.net/json_encode for example.[/ot] Quote Link to comment Share on other sites More sharing options...
prashanth Posted February 19, 2010 Share Posted February 19, 2010 You will get external library json.php if you download this and include in your script the json functions(json_encode and json_decode etc...) will work as usually. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.