• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Znote acc few problems at website in linux(permissions)

CipsoftStinks

www.relicaria.com
Joined
Oct 1, 2016
Messages
946
Solutions
3
Reaction score
138
Location
Argentina
Hello is my first tie hosting a server into a linux host
im using znote acc without problems into windows, but the website has few bugs when is hosted in linux
pd: ye i edited config.php to "lin"

Code:
Warning: fopen(engine/cache/news.cache.php): failed to open stream: Permission denied in /opt/lampp/htdocs/engine/function/cache.php on line 91

Warning: fwrite() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 92

Warning: fclose() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 93

Code:
Warning: fopen(engine/cache/topPowergamers.cache.php): failed to open stream: Permission denied in /opt/lampp/htdocs/engine/function/cache.php on line 91

Warning: fwrite() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 92

Warning: fclose() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 93

Code:
Warning: fopen(engine/cache/topCasts.cache.php): failed to open stream: Permission denied in /opt/lampp/htdocs/engine/function/cache.php on line 91

Warning: fwrite() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 92

Warning: fclose() expects parameter 1 to be resource, boolean given in /opt/lampp/htdocs/engine/function/cache.php on line 93

cache.php
Code:
<?php

    class Cache
    {
        protected $_file = false;
        protected $_lifespan = 0;
        protected $_content;

        const EXT = '.cache.php';


        /**
         * @param  string $file
         * @access public
         * @return void
        **/
        public function __construct($file) {
            $this->_file = $file . self::EXT;
            $this->setExpiration(config('cache_lifespan'));
        }


        /**
         * Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
         *
         * @param  integer $span
         * @access public
         * @return void
        **/
        public function setExpiration($span) {
            $this->_lifespan = $span;
        }


        /**
         * Set the content you'd like to cache.
         *
         * @param  mixed $content
         * @access public
         * @return void
        **/
        public function setContent($content) {
            switch (strtolower(gettype($content))) {
                case 'array':
                    $this->_content = json_encode($content);
                    break;

                default:
                    $this->_content = $content;
                    break;
            }
        }


        /**
         * Validates whether it is time to refresh the cache data or not.
         *
         * @access public
         * @return boolean
        **/
        public function hasExpired() {
            if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
                return false;
            }

            return true;
        }

        /**
         * Returns remaining time before scoreboard will update itself.
         *
         * @access public
         * @return integer
        **/
        public function remainingTime() {
            $remaining = 0;
            if (!$this->hasExpired()) {
                $remaining = (filemtime($this->_file) + $this->_lifespan) - time();
            }
            return $remaining;
        }


        /**
         * Saves the content into its appropriate cache file.
         *
         * @access public
         * @return void
        **/
        public function save() {
            $handle = fopen($this->_file, '');
            fwrite($handle, $this->_content);
            fclose($handle);
        }


        /**
         * Loads the content from a specified cache file.
         *
         * @access public
         * @return mixed
        **/
        public function load() {
            if (!is_file($this->_file)) {
                return false;
            }

            ob_start();
            include_once($this->_file);
            $content = ob_get_clean();

            if (!isset($content) && strlen($content) == 0) {
                return false;
            }

            if ($content = json_decode($content, true)) {
                return (array) $content;
            } else {
                return $content;
            }
        }
    }
 
solved via ssh i typed
chmod o+rw /opt/lampp/htdocs/engine/cache/news.cache.php
chmod o+rw /opt/lampp/htdocs/engine/cache/topPowergamers.cache.php
chmod o+rw /opt/lampp/htdocs/engine/cache/topCasts.cache.php


hope this could help others users in a future
 
The web files are probably not owned by the web server.

Enter web directory ( etc: /opt/lampp/htdocs/ )
Do the command:
chown -R www-data:www-data *

Else you might get similar issues with other things, such as highscores page and other systems using the cache class.
 
The web files are probably not owned by the web server.

Enter web directory ( etc: /opt/lampp/htdocs/ )
Do the command:
chown -R www-data:www-data *

Else you might get similar issues with other things, such as highscores page and other systems using the cache class.
i solved it , but thanks @Znote
also i uploaded the commands telling others how i solved it ^^

thanks men
 
Back
Top