Jump to content

json support


Recommended Posts

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.