We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2690
    • 148 Posts
    Hello all, i’m running a modx install (0.9.6.2 rev 4077) on dreamhost: Apache/2.2.9 (Unix) PHP/4.4.9 mod_ssl/2.2.11 OpenSSL/0.9.8c mod_fastcgi/2.4.6

    For some reason some cache files are being generated with: -------- (blank) permissions resulting in this kind of an error:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »
     
    PHP error debug
      Error: 	file(assets/cache/docid_51.pageCache.php) [function.file]: failed to open stream: Permission denied	 
      Error type/ Nr.: 	Warning - 2	 
      File: 	/mnt/local/home/thatguysocrates/DOMAIN.com/manager/includes/document.parser.class.inc.php	 
      Line: 	370	 
      Line 370 source: 	$flContent= implode("", file($cacheFile)); 	 
     
    Parser timing
      MySQL: 	0.0156 s	(0 Requests)
      PHP: 	0.0284 s	 
      Total: 	0.0440 s
    


    what weird about this is that most of the cache files are generated with the correct permissions 644 and about 30% of the files with blank ones.

    I tried clearing the cache, changing the file permissions in the file manager, but nothing helps. Is there a work around for FastCGI servers or there is something else going on here?

    I also noticed this:
    My File Manager Path: /home/thatguysocrates/DOMAIN.com/ but my Resource path: /mnt/local/home/thatguysocrates/DOMAIN.com/assets/
    Can it cause the issue?

    Thanks for any help!

    Aleks
      MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
      • 2690
      • 148 Posts
      Got a reply from dreamhost:

      As far as the sessions, you’re on a standard webserver with local
      storage, so I’m not sure why you’d be seeing issues. We used to actually
      mount customer storage over NFS, but we’ve phased that out...so there
      shouldn’t be any weirdness there. I would suggest contacting the
      developer and asking what might cause the software to write files with
      those permissions. We’ll be happy to share any info about our server
      configuration.

      Which file is responsible for generating the cache files?
      Can i hard code the permissions in there somehow?

      Thanks!
        MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
        • 2690
        • 148 Posts
        Ok seems like the resource path should be: /home/thatguysocrates/DOMIAN.com/ without /mnt/local/ - how can i fix it? The path is generated automatically...

          MODx Revo 2.0.6-pl (Traditional) | Apache 2.2.3 | PHP 5.2.14 | MySQL 5.0.77 | MAC OS 10.6.5 | FF 3.6/Chrome 9.0.5
          • 25321
          • 18 Posts
          Analogy problem

          « MODx Parse Error »
          MODx encountered the following error while attempting to parse the requested resource:
          « PHP Parse Error »
           
          PHP error debug
            Error: 	file(assets/cache/docid_334.pageCache.php) [function.file]: failed to open stream: Permission denied	 
            Error type/ Nr.: 	Warning - 2	 
            File: 	/home/httpd/vhosts/websee.ru/subdomains/franke/httpdocs/manager/includes/document.parser.class.inc.php	 
            Line: 	368	 
            Line 368 source: 	$flContent= implode("", file($cacheFile)); 	 
           
          Parser timing
            MySQL: 	0.0067 s	(0 Requests)
            PHP: 	0.0365 s	 
            Total: 	0.0432 s	 


          Details:
          MODx 0.9.6.3 rev 4565

          Server:
          PHP Version 4.4.9
          System Linux baldor.mchost.ru 2.6.9-78.0.8.ELsmp #1 SMP Wed Nov 19 20:05:04 EST 2008 i686
          Build Date Aug 14 2008 15:16:00
          Configure Command ’./configure’ ’--host=i686-redhat-linux-gnu’ ’--build=i686-redhat-linux-gnu’ ’--target=i386-redhat-linux’ ’--program-prefix=’ ’--prefix=/usr’ ’--exec-prefix=/usr’ ’--bindir=/usr/bin’ ’--sbindir=/usr/sbin’ ’--sysconfdir=/etc’ ’--datadir=/usr/share’ ’--includedir=/usr/include’ ’--libdir=/usr/lib’ ’--libexecdir=/usr/libexec’ ’--localstatedir=/var’ ’--sharedstatedir=/usr/com’ ’--mandir=/usr/share/man’ ’--infodir=/usr/share/info’ ’--cache-file=../config.cache’ ’--with-config-file-path=/etc’ ’--with-config-file-scan-dir=/etc/php.d’ ’--enable-force-cgi-redirect’ ’--disable-debug’ ’--enable-pic’ ’--disable-rpath’ ’--enable-inline-optimization’ ’--with-bz2’ ’--with-db4=/usr’ ’--with-curl’ ’--with-exec-dir=/usr/bin’ ’--with-freetype-dir=/usr’ ’--with-png-dir=/usr’ ’--with-gd’ ’--enable-gd-native-ttf’ ’--without-gdbm’ ’--with-gettext’ ’--with-ncurses’ ’--with-gmp’ ’--with-iconv’ ’--with-jpeg-dir=/usr’ ’--with-openssl’ ’--with-png’ ’--with-pspell’ ’--with-regex=system’ ’--with-xml’ ’--with-expat-dir=/usr’ ’--with-dom=shared,/usr’ ’--with-dom-xslt=/usr’ ’--with-dom-exslt=/usr’ ’--with-xmlrpc=shared’ ’--with-pcre-regex=/usr’ ’--with-zlib’ ’--with-layout=GNU’ ’--enable-exif’ ’--enable-ftp’ ’--enable-magic-quotes’ ’--enable-safe-mode’ ’--enable-sockets’ ’--enable-sysvsem’ ’--enable-sysvshm’ ’--enable-track-vars’ ’--enable-trans-sid’ ’--enable-yp’ ’--enable-wddx’ ’--with-pear=/usr/share/pear’ ’--with-imap=shared’ ’--with-imap-ssl’ ’--with-kerberos’ ’--with-ldap=shared’ ’--with-mysql=shared,/usr’ ’--enable-xslt=shared’ ’--with-xslt-sablot’ ’--with-sablot-js=/usr’ ’--with-pgsql=shared’ ’--with-snmp=shared,/usr’ ’--with-snmp=shared’ ’--enable-ucd-snmp-hack’ ’--with-unixODBC=shared,/usr’ ’--enable-memory-limit’ ’--enable-bcmath’ ’--enable-shmop’ ’--enable-calendar’ ’--enable-dbx’ ’--enable-dio’ ’--enable-mcal’ ’--enable-mbstring=shared’ ’--enable-mbstr-enc-trans’ ’--enable-mbregex’ ’--with-apxs2=/usr/sbin/apxs’
          Server API Apache 2.0 Handler
            • 22303 MODX Staff
            • 10,725 Posts
            Check file permissions; sounds like the umask for the user running PHP (in fastcgi, this would be the same as your account that you use for ftp) may not be set properly so files are written without proper default permissions (e.g. 0644).
              • 29085
              • 2 Posts
              Hi smiley It’s one year now. But then i managed to solve problem by little hacking..

              postProcess() function in document.parser.class.inc, line 596

              function postProcess() {
              // if the current document was generated, cache it!
              if ($this->documentGenerated == 1 && $this->documentObject[’cacheable’] == 1 && $this->documentObject[’type’] == ’document’ && $this->documentObject[’published’] == 1) {
              $basepath= $this->config["base_path"] . "assets/cache";
              // invoke OnBeforeSaveWebPageCache event
              $this->invokeEvent("OnBeforeSaveWebPageCache");
              if ($fp= @ fopen($basepath . "/docid_" . $this->documentIdentifier . ".pageCache.php", "w")) {
              // get and store document groups inside document object. Document groups will be used to check security on cache pages
              $sql= "SELECT document_group FROM " . $this->getFullTableName("document_groups") . " WHERE document=’" . $this->documentIdentifier . "’";
              $docGroups= $this->db->getColumn("document_group", $sql);

              // Attach Document Groups and Scripts
              if (is_array($docGroups)) $this->documentObject[’__MODxDocGroups__’] = implode(",", $docGroups);

              $docObjSerial= serialize($this->documentObject);
              $cacheContent= $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;
              fputs($fp, "<?php die(’Unauthorized access.’); ?>$cacheContent");
              fclose($fp);
              }
              }

              // Useful for example to external page counters/stats packages
              if ($this->config[’track_visitors’] == 1) {
              $this->invokeEvent(’OnWebPageComplete’);
              }
              // end post processing
              }

              i changed to:

              function postProcess() {
              // if the current document was generated, cache it!
              if ($this->documentGenerated == 1 && $this->documentObject[’cacheable’] == 1 && $this->documentObject[’type’] == ’document’ && $this->documentObject[’published’] == 1) {
              $basepath= $this->config["base_path"] . "assets/cache";
              // invoke OnBeforeSaveWebPageCache event
              $this->invokeEvent("OnBeforeSaveWebPageCache");

              // get and store document groups inside document object. Document groups will be used to check security on cache pages
              $sql= "SELECT document_group FROM " . $this->getFullTableName("document_groups") . " WHERE document=’" . $this->documentIdentifier . "’";
              $docGroups= $this->db->getColumn("document_group", $sql);

              // Attach Document Groups and Scripts
              if (is_array($docGroups)) $this->documentObject[’__MODxDocGroups__’] = implode(",", $docGroups);

              $docObjSerial= serialize($this->documentObject);
              $cacheContent= $docObjSerial . "<!--__MODxCacheSpliter__-->" . $this->documentContent;

              file_put_contents($basepath . "/docid_" . $this->documentIdentifier . ".pageCache.php", "<?php die(’Unauthorized access.’); ?>" . $cacheContent);
              if(!is_readable($basepath . "/docid_" . $this->documentIdentifier . ".pageCache.php"))
              unlink($basepath . "/docid_" . $this->documentIdentifier . ".pageCache.php");


              }

              // Useful for example to external page counters/stats packages
              if ($this->config[’track_visitors’] == 1) {
              $this->invokeEvent(’OnWebPageComplete’);
              }
              // end post processing
              }


              So now the function checks if just created file is readable - if not removes it. There will be no errors in the frontent about inaccessable cache files.

              I still dont know why that was but the error occured becaouse SOMETIMES newly created files had premissions "---" (yes ---) not "664".

              Solutions worked for me wink