Hp Fatal Error Call To Undefined Function Json_decode
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this call to undefined function json_decode centos site About Us Learn more about Stack Overflow the company Business Learn more call to undefined function json_encode() ubuntu about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss php enable json Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PHP Fatal error:
Centos Php Json
Call to undefined function json_decode() up vote 119 down vote favorite 24 Apache is logging PHP Fatal error: Call to undefined function json_decode(). After some googling, it seems this problem is a result of not having the latest version of php. Oddly, running php --version ouputs PHP 5.5.1-2+debphp.org~precise+2 (cli) (built: Aug 6 2013 10:49:43) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright call to undefined function is_json() (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.2-dev, Copyright (c) 1999-2013, by Zend Technologies with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans Clearly showing that my php version is greater than 5.1. Any ideas as to what could cause this, or the steps to take to find out? EDIT: The result of a script echoing phpversion is 5.5.1-2+debphp.org~precise EDIT: The result of phpinfo() is also PHP Version 5.5.1-2+debphp.org~precise+2 Furthermore, in the phpinfo(), it lists the module JSON and the module authors (Omar Kilani, Scott MacVicar). php json apache ubuntu share|improve this question edited Dec 5 '13 at 18:52 asked Aug 14 '13 at 18:24 MirroredFate 4,35894070 2 Check the disable_functions ini directive to see if json_decode is in that list –Orangepill Aug 14 '13 at 18:34 Does the json module show up in your phpinfo() output? –tcmitche Aug 14 '13 at 18:38 disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_ge\ t_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, –MirroredFate Aug 14 '13 at 18:39 Ubuntu 12.04 has a package: php-services-json. Maybe this helps... –jgb Aug 14 '13 at 18:40 1 @jgb That's the PEAR package Services_Json. Which is also quite encompassing, parses a bit Javascr
reading if you would like to know how to fix it. To determine the https://alephnull.uk/content/how-fix-jsondecode-php-0 symptoms: Enable error messages to be shown by writing ini_set('display_errors', '1'); in your PHP code. Most likely, you will be given this error message now: Php Fatal Error Call http://serverfault.com/questions/308653/fatal-error-call-to-undefined-function-json-encode To Undefined Function Json_decode The solution: Open your php.ini file (eg. nano /etc/php/php.ini depending on distro) In the configuration file there will be a section called Dynamic Extensions. You call to will find a list of extensions which have been conveniently commented out to improve PHP performance. Uncomment the line ;extension=json.so by removing the semi-colon Save the configuration file and restart Apache (eg. /etc/rc.d/httpd restart depending on your distro) Hopefully this will save you having to bang your head against a wall when you can't parse even the most call to undefined simplest of JSON. For good measure, you may well want to try this example from the php.net website: Assuming you've fixed the problem, this should output: object(stdClass)#1 (5) { ["a"] => int(1) ["b"] => int(2) ["c"] => int(3) ["d"] => int(4) ["e"] => int(5) } array(5) { ["a"] => int(1) ["b"] => int(2) ["c"] => int(3) ["d"] => int(4) ["e"] => int(5) } This was my first blog post for this site, so I feel an introduction is in order. My name is Nick Hatter and I am currently studying MEng Computer Science at the School of Electronics and Computer Science (ECS) in Southampton University. I decided it was time to do my first blog post seeing as I keep running into 'gotcha!'s and I feel I would save everyone a lot of hassle if I shared some of my solutions! +1 Tweet Like Comments Pete Donnell replied on October 13, 2010 - 11:53 Permalink Workaround for PHP 5.1.6 Hi Nick, Nice article.
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Fatal error: Call to undefined function json_encode() ..? up vote 1 down vote favorite 2 Im trying to use json with php and i keep getting the error PHP Fatal error: Call to undefined function json_encode() I am using php version 5.3.6 and on phpinfo(); nothing mentions json. Any suggestions? php json share|improve this question asked Sep 6 '11 at 17:00 Jonah Katz 108114 migrated from stackoverflow.com Sep 6 '11 at 18:32 This question came from our site for professional and enthusiast programmers. Try installing: pecl.php.net/package/json –stslavik Sep 6 '11 at 17:02 @stslavik When i try installing it says ` cannot install: doesn't work with PHP version : 5 (Doesn't support PHP 5 52)` –Jonah Katz Sep 6 '11 at 17:06 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote accepted For some reason your PHP was compiled without JSON. Either: Recompile it Install a package Use a function that emulates json_encode, which can be found in the comments section of http://php.net/manual/en/function.json-encode.php share|improve this answer answered Sep 6 '11 at 17:04 Paul S. 1462 add a comment| up vote 2 down vote try in shell (assuming you are using linux), otherwise refer to phpinfo(); php -i | grep json example php -i | grep json json json support => enabled json version => 1.2.1 There is an interesting comment on t