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
https://forums.phpfreaks.com/topic/192521-json-support/
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
https://forums.phpfreaks.com/topic/192521-json-support/#findComment-1014361
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.