JSON

Status
Not open for further replies.

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
Up until yesterday I could run a script using JSON extensions. Today I am getting:

Fatal error: Call to undefined function json_decode() in xxxxxx.php on line 24

Anyone has any idea what might have gone wrong.

I rechecked the phpextentions and json is enabled. I am using version 5.5.
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
An update to the above.

I ran the following code to get the loaded extensions:

$extensions = get_loaded_extensions();

foreach($extensions as $extension) {
echo $extension , "<br>";
}

The result is:

Core
date
ereg
libxml
openssl
pcre
sqlite3
zlib
bz2
calendar
ctype
curl
hash
filter
ftp
gettext
gmp
SPL
iconv
pcntl
readline
Reflection
session
standard
shmop
SimpleXML
exif
tokenizer
xml
litespeed
mhash

seems like the json module isn't being loaded and dl() is not supported.

Can anyone see why this happened?
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Those with sufficient access would be able to help in this case. Might take a bit.
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
i'll wait :) i tried choosing different PHP versions and enabling JSON module in "Select PHP version" to no avail.
 

cloudwhe

New Member
Messages
20
Reaction score
0
Points
1
json should be loaded by default on php5 and most free hosting uses php5.3+ version. json module was not present when you run get_loaded_extensions() .

Need admin here...
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
yes I agree.

JSON used to be loaded as I have a php script that relies on json_decode. One fine day this script stopped working and when I debugged why I realised that the json module is not being loaded. Apart from db() is there a way to try to make PHP load json?
 

cloudwhe

New Member
Messages
20
Reaction score
0
Points
1
That's very odd. Server admins might have removed json module you should contact them and ask why they removed it otherwise this is a bug and needs some fixing here. Have you heard msgpack?
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
my level of support is only through the community forums as I use the free service. I am still hoping one of the admins will look at this thread and rectify the situation.
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
I hadn't heared of msgpack but googled it and seems like a good replacement for the json. BUT once again it needs to be loaded with PHP and it isn't so not much use. If things remain as is I will have to rewrite my script without the JSON database.
 

cloudwhe

New Member
Messages
20
Reaction score
0
Points
1
Have you tried checking the php extention? It seems like json module was not loaded by default you need to manually add it see the image below

18ljth.png


One thing. It seems like they are restricting php script that are not in the root directory. I tried outputting a simple echo in the root and everything was printed both html and php text but when I move the script in /demo/php/json.php the php code failed to run. Does this happen to you guys?
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
Try changing the PHP version to 5.6 and see if having JSON enabled with that works.
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
I have this script in /public_html

PHP:
<?php
date_default_timezone_set('Europe/Malta');

echo "The time is " . date("h:i:sa") . "<br>";
echo "<br>";
 
echo phpversion() . "<br>";
echo "<br>";

$disabled_functions = ini_get('disable_functions');
print_r($disabled_functions);

echo "<br>";
echo "<br>";
echo "<br>";

$extensions = get_loaded_extensions();

foreach($extensions as $extension) {
echo $extension , "<br>";
}

echo "<br>";
echo "<br>";

echo "Json loaded?:" . extension_loaded("json");

?>

and this is the output of that script:

output.jpg


and this is my settings for phpversion:

settings.jpg
 

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
I tried all versions available (5.4, 5.5, 5.6, 7.0) with JSON enabled. still no output showing JSON as loaded.
 

cloudwhe

New Member
Messages
20
Reaction score
0
Points
1
Why did you not check json? You should put a check on json to make it available. (that is what I understand)

I tried your script and it's working it's output is:
------------------
Json loaded?:1
------------------

You should put a check on json. Go goto php settings and check the json box. I tried and it works.

Try accessing this http://jeorlie.x10host.com/json.php
 
Last edited:

r0nmltx1

New Member
Messages
29
Reaction score
0
Points
1
Some users are having the same issue where some PHP modules would not load regardless if it has been checked and what other PHP version they pick.

now that is even weirder. how do i get solving that?
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
There's some good examples on this forum of the situation. A couple are about the mysql(i) module not being there.

So far it doesn't appear to be user resolvable. (Without recreating an account, that is.)

If you really want to try to resolve the issue for yourself ASAP, you could always close your account. Once it's closed down completely, register again (same login credentials as before[?]) and then see if it works from there.
I don't know what's causing the issue (those who fixed it for others would) so there's no guarantee that it'll do the job.
 

cloudwhe

New Member
Messages
20
Reaction score
0
Points
1
We really need admin here... hope they can see this asap. I have also one question regarding cname.
 
Status
Not open for further replies.
Top