I just installed my first LAMP and NetBean in Ubuntu. I imported a small website and tried to run it both locally and remotely, but the pages that use json_decode
(and other functions) don't work on the local server.
For example this page:
<?php
echo "X ";
var_dump(json_decode("{}"));
echo " Y";
?>
On the managed server shows X object(stdClass)#1 (0) { } Y
, but on the local server shows X
only.
I ctrl+clicked on the json_decode
function name, and the file json.php
opened with a json_decode
function with the empty body. I don't understand if that's just the definition of an interface or the real function (I'm learning PHP), but the fact that the rendering stops there, without error messages, sounds weird.
UPDATE:
I uninstalled all the packages listed at the "Starting over" section in this page, and re-installed with sudo tasksel install lamp-server
.
The next day there was a massive automatic update. I don't know if there is a relation between the installation and the update, or if the update would have come anyway.
Right now I'm still at the same position: some pages are rendered correctly locally, but my website uses json on almost every page, so I can't use the local server. (I was hoping to be able to use it in the next days, when I will be visiting the in-laws, where Internet is still an unknown concept.)
UPDATE 2:
The fact mentioned earlier that json_decode()
has an empty body is not a problem. I just right clicked on session_start();
, and the file session.php opened with the function defined as function session_start () {}
. I don't understand why the library functions contain empty bodies, but session_start()
works, so json_decode()
should as well.