php74-json not running in apache

phpinfo states the authors of the extension, yet neither json_decode, nor json_encode work when run on Apache 2.4.
json_encode error:
Code:
Hello world
Fatal error: Uncaught Error: Call to undefined function json_encode() in /usr/local/www/bleh/jsondecode3.php:9 Stack trace: #0 {main} thrown in /usr/local/www/bleh/jsondecode3.php on line 9
json_encode working correct:
Code:
php jsondecode3.php
PHP Warning:  Module 'json' already loaded in Unknown on line 0
Hello world{"name":"John","age":30,"city":"New York"}

json_decode outputs the same generic "call to undefined function", and no - loading the extensions through php.ini or /usr/local/etc/php/ext-20-json.ini ofc does not make any difference.
Anyone else experiences this particular issue? Could it be some licensing issue?
 
Check if you're not accidentally mixing PHP 7.4 and 8.0.
 
Check if you're not accidentally mixing PHP 7.4 and 8.0.
Code:
/usr/ports/lang/php80 $ make deinstall && cd ../php81 && make deinstall
===>  Deinstalling for php80
===>   php80 not installed, skipping
===>  Deinstalling for php81
===>   php81 not installed, skipping
 
I've got PHP 7.4.28 and Apache 2.4 and json working fine - so you've got something mixed up on your set-up.

If it works from the CLI but not under Apache then you might need to restart Apache (if using mod_php) or restart php-fpm (if you are using FPM).

The warning about module json already loaded suggests you've got it twice in some configuration file (can't remember which one).
 
Back
Top