Problem with jsonconfig.php



  • Hi,
    I installed PufferPanel correctly and it worked some days ago. But today I have this problem:
    When I go to the page appears this:

    Fatal error: Call to undefined function PufferPanel\Core\Config\json_decode() in /srv/pufferpanel/src/core/config/jsonconfig.php on line 37

    Here's the jsonconfig:
    <?php
    /*
    PufferPanel - A Game Server Management Panel
    Copyright (c) 2015 Dane Everitt

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program. If not, see http://www.gnu.org/licenses/.
    */
    namespace PufferPanel\Core\Config;
    use \Exception;

    class JsonConfig implements ConfigInterface {

    private $config;
    
    /**
     * Constructor class for implementing configuration files from JSON.
     *
     * @param string $path Configuration file relative to BASE_DIR
     * @param bool $array
     */
    public function __construct($path, $array = false) {
    	if(!file_exists(BASE_DIR.$path)) {
    		throw new Exception("The config file ".$path." does not exist.");
    	}
    
    	$this->config = json_decode(file_get_contents(BASE_DIR.$path), $array);
    
    	if(json_last_error() != "JSON_ERROR_NONE") {
    		throw new Exception("An error occured when trying decode ".$path.". ".json_last_error());
    	}
    }
    
    public function config($base = null) {
    	return (is_null($base)) ? $this->config : $this->config->{$base};
    }
    

    Line 37 is
    $this->config = json_decode(file_get_contents(BASE_DIR.$path), $array);

    }



  • This post is deleted!


  • Provide the full error that is being shown, because it sounds like you did not run the installer, but just installed our files.



  • http://i.imgur.com/yd66ytR.png
    There is only this on the page



  • I changed it with this:
    https://github.com/PufferPanel/PufferPanel/blob/master/src/core/config/jsonconfig.php

    Now I have:
    Fatal error: Call to undefined function PufferPanel\Core\Config\json_decode() in /srv/pufferpanel/src/core/config/jsonconfig.php on line 59

    Line 59:
    $this->config = json_decode(file_get_contents(BASE_DIR.$path), $array);



  • You should not be touching any of the files. By doing so, you will break more things than it will resolve.

    Something changed on the system since it lasted worked, and it appears that your files are now not-in-sync with what should be there.



  • I have got a backup of this file but, nothing changed.
    No one couldn't touch my files and I didn't it.
    So, what's the problem?



  • The fact you changed it to something else that we do not provide is a concern.

    Just so it's easier, in the root for the panel, use the following 2 commands:
    git stash
    git checkout tags/0.8.4



  • fatal: Not a git repository (or any of the parent directories): .git



  • You are not in the panel's folder.
    /srv/pufferpanel (or PufferPanel depending on the folder casing you have)



  • root@vps231530:/srv/pufferpanel# git stash
    Saved working directory and index state WIP on (no branch): f4a3090 Bump version
    HEAD is now at f4a3090 Bump version
    root@vps231530:/srv/pufferpanel# git checkout tags/0.8.4
    HEAD is now at f4a3090... Bump version



  • @LordRalex said:

    You are not in the panel's folder.
    /srv/pufferpanel (or PufferPanel depending on the folder casing you have)

    Now what I have to do?



  • Print the results of using ls -l in that directory



  • root@vps231530:/srv/pufferpanel# ls -l
    total 1276
    drwxr-xr-x 6 www-data www-data 4096 gen 4 19:08 app
    -rw-r--r-- 1 www-data www-data 354 gen 4 19:08 build.xml
    -rw-r--r-- 1 www-data www-data 489 gen 4 19:08 composer.json
    -rw-r--r-- 1 www-data www-data 37617 gen 4 19:09 composer.lock
    -rw-r--r-- 1 www-data www-data 1179424 gen 4 19:08 composer.phar
    -rw-r--r-- 1 www-data www-data 340 gen 4 19:09 config.json
    -rw-r--r-- 1 www-data www-data 6064 gen 4 19:08 CONTRIBUTING.md
    drwxr-xr-x 2 www-data www-data 4096 gen 4 19:08 install
    -rw-r--r-- 1 www-data www-data 32452 gen 4 19:08 LICENSE
    drwxr-xr-x 2 www-data www-data 4096 gen 9 19:32 public
    -rw-r--r-- 1 root root 4443 gen 9 20:04 README.md
    drwxr-xr-x 7 www-data www-data 4096 gen 4 19:08 src
    drwxr-xr-x 2 www-data www-data 4096 gen 4 19:08 tools
    drwxr-xr-x 18 www-data www-data 4096 gen 4 19:09 vendor



  • We have released a new version of PufferPanel and Scales with an improved installation process and many bug fixes. Please try the latest version and see if it fixes your issues.

    I’m marking this question as solved since there has been a long period of inactivity on it. If you are still experiencing issues, please create a new question. Thanks!


Log in to reply
 

Looks like your connection to PufferPanel Community was lost, please wait while we try to reconnect.