Právě je 20 dub 2024 01:21

Všechny časy jsou v UTC + 1 hodina [ Letní čas ]




Odeslat nové téma Odpovědět na téma  [ Příspěvků: 6 ] 
Autor Zpráva
 Předmět příspěvku: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 26 říj 2014 14:06 
C4 zákazník

Registrován:
04 říj 2011 14:37
Příspěvky:
12
Dobrý den,
při kontrole error logu na mě vyběhla řada takovýchto hlášek:

[Sun Oct 26 12:10:38 2014] [error] [client 66.249.67.75] PHP Warning: tempnam() [<a href='function.tempnam'>function.tempnam</a>]: SAFE MODE Restriction in effect. The script whose uid/gid is 3115/3563 is not allowed to access /data/www/ceske-ponozky.eu owned by uid/gid 0/0 in /data/www/ceske-ponozky.eu/www.ceske-ponozky.eu/classes/PrestaShopAutoload.php on line 151
[Sun Oct 26 12:10:38 2014] [error] [client 66.249.67.75] Cannot write temporary file


Můžete mí prosím pomoci?
Děkuji moc.
LJ


Nahoru
 Profil  
 
 Předmět příspěvku: Re: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 30 říj 2014 11:26 
C4 podpora
C4 podpora

Registrován:
30 čer 2009 09:14
Příspěvky:
8504
Dobrý den,

použijte novější verzi souboru classes/PrestaShopAutoload.php z githubu. Takže původní kód nahraďte tímto:

Kód:
<?php
/*
* 2007-2014 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <contact@prestashop.com>
*  @copyright  2007-2014 PrestaShop SA
*  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*/

/**
* @since 1.5
*/
class PrestaShopAutoload
{
   /**
    * File where classes index is stored
    */
   const INDEX_FILE = 'cache/class_index.php';

   /**
    * @var Autoload
    */
   protected static $instance;

   /**
    * @var string Root directory
    */
   protected $root_dir;

   /**
    *  @var array array('classname' => 'path/to/override', 'classnamecore' => 'path/to/class/core')
    */
   public $index = array();

   public $_include_override_path = true;
   
   protected static $class_aliases = array(
      'Collection' => 'PrestaShopCollection',
      'Autoload' => 'PrestaShopAutoload',
      'Backup' => 'PrestaShopBackup',
      'Logger' => 'PrestaShopLogger'
   );

   protected function __construct()
   {
      $this->root_dir = _PS_CORE_DIR_.'/';
      $file = $this->normalizeDirectory(_PS_ROOT_DIR_).PrestaShopAutoload::INDEX_FILE;
      if (@filemtime($file) && is_readable($file))
         $this->index = include($file);
      else
         $this->generateIndex();
   }

   /**
    * Get instance of autoload (singleton)
    *
    * @return Autoload
    */
   public static function getInstance()
   {
      if (!PrestaShopAutoload::$instance)
         PrestaShopAutoload::$instance = new PrestaShopAutoload();

      return PrestaShopAutoload::$instance;
   }

   /**
    * Retrieve informations about a class in classes index and load it
    *
    * @param string $classname
    */
   public function load($classname)
   {
      // Retrocompatibility
      if (isset(PrestaShopAutoload::$class_aliases[$classname]) && !interface_exists($classname, false) && !class_exists($classname, false))
         return eval('class '.$classname.' extends '.PrestaShopAutoload::$class_aliases[$classname].' {}');

      // regenerate the class index if the requested file doesn't exists
      if ((isset($this->index[$classname]) && $this->index[$classname]['path'] && !is_file($this->root_dir.$this->index[$classname]['path']))
         || (isset($this->index[$classname.'Core']) && $this->index[$classname.'Core']['path'] && !is_file($this->root_dir.$this->index[$classname.'Core']['path'])))
         $this->generateIndex();

      // If $classname has not core suffix (E.g. Shop, Product)
      if (substr($classname, -4) != 'Core')
      {
         // If requested class does not exist, load associated core class
         if (isset($this->index[$classname]) && !$this->index[$classname]['path'])
         {
            require($this->root_dir.$this->index[$classname.'Core']['path']);

            if ($this->index[$classname.'Core']['type'] != 'interface')
               eval($this->index[$classname.'Core']['type'].' '.$classname.' extends '.$classname.'Core {}');
         }
         else
         {
            // request a non Core Class load the associated Core class if exists
            if (isset($this->index[$classname.'Core']))
               require_once($this->root_dir.$this->index[$classname.'Core']['path']);

            $class_dir = (isset($this->index[$classname]['override'])
               && $this->index[$classname]['override'] === true) ? $this->normalizeDirectory(_PS_ROOT_DIR_) : $this->root_dir;

            if (isset($this->index[$classname]))
               require_once($class_dir.$this->index[$classname]['path']);
         }
      }
      // Call directly ProductCore, ShopCore class
      elseif (isset($this->index[$classname]['path']) && $this->index[$classname]['path'])
         require($this->root_dir.$this->index[$classname]['path']);
   }

   /**
    * Generate classes index
    */
   public function generateIndex()
   {
      $classes = array_merge(
         $this->getClassesFromDir('classes/'),
         $this->getClassesFromDir('controllers/')
      );

      if ($this->_include_override_path)
         $classes = array_merge(
            $classes,
            $this->getClassesFromDir('override/classes/', defined('_PS_HOST_MODE_')),
            $this->getClassesFromDir('override/controllers/', defined('_PS_HOST_MODE_'))
         );

      ksort($classes);
      $content = '<?php return '.var_export($classes, true).'; ?>';

      // Write classes index on disc to cache it
      $filename = $this->normalizeDirectory(_PS_ROOT_DIR_).PrestaShopAutoload::INDEX_FILE;
      $filename_tmp = tempnam(dirname($filename), basename($filename.'.'));
      if ($filename_tmp !== false && file_put_contents($filename_tmp, $content) !== false)
      {
         if (!@rename($filename_tmp, $filename))
            unlink($filename_tmp);
         else
            @chmod($filename, 0666);
      }
      // $filename_tmp couldn't be written. $filename should be there anyway (even if outdated), no need to die.
      else
         error_log('Cannot write temporary file '.$filename_tmp);
      $this->index = $classes;
   }

   /**
    * Retrieve recursively all classes in a directory and its subdirectories
    *
    * @param string $path Relativ path from root to the directory
    * @return array
    */
   protected function getClassesFromDir($path, $host_mode = false)
   {
      $classes = array();
      $root_dir = $host_mode ? $this->normalizeDirectory(_PS_ROOT_DIR_) : $this->root_dir;

      foreach (scandir($root_dir.$path) as $file)
      {
         if ($file[0] != '.')
         {
            if (is_dir($root_dir.$path.$file))
               $classes = array_merge($classes, $this->getClassesFromDir($path.$file.'/', $host_mode));
            else if (substr($file, -4) == '.php')
            {
               $content = file_get_contents($root_dir.$path.$file);
                $pattern = '#\W((abstract\s+)?class|interface)\s+(?P<classname>'.basename($file, '.php').'(?:Core)?)'
                         .'(?:\s+extends\s+[a-z][a-z0-9_]*)?(?:\s+implements\s+[a-z][a-z0-9_]*(?:\s*,\s*[a-z][a-z0-9_]*)*)?\s*\{#i';
                if (preg_match($pattern, $content, $m))
                {
                   $classes[$m['classname']] = array(
                      'path' => $path.$file,
                      'type' => trim($m[1]),
                      'override' => $host_mode
                   );

                  if (substr($m['classname'], -4) == 'Core')
                     $classes[substr($m['classname'], 0, -4)] = array(
                        'path' => '',
                        'type' => $classes[$m['classname']]['type'],
                        'override' => $host_mode
                     );
                }
            }
         }
      }

      return $classes;
   }

   public function getClassPath($classname)
   {
      return (isset($this->index[$classname]) && isset($this->index[$classname]['path'])) ? $this->index[$classname]['path'] : null;
   }

   private function normalizeDirectory($directory)
   {
      $last = $directory[strlen($directory) - 1];

      if (in_array($last, array('/', '\\')))
      {
         $directory[strlen($directory) - 1] = DIRECTORY_SEPARATOR;
         return $directory;
      }

      $directory .= DIRECTORY_SEPARATOR;
      return $directory;
   }
}

Pak v error logu prověřte, jestli stále dochází k chybovým hlášením.

_________________
Radek Plašil
Webhosting C4
https://www.c4.cz/


Nahoru
 Profil  
 
 Předmět příspěvku: Re: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 30 říj 2014 16:42 
C4 zákazník

Registrován:
04 říj 2011 14:37
Příspěvky:
12
Dobré odpoledne.
Děkuji za reakci. Tenhle soubor jsem už zkoušel nahradit i dříve, ale bohužel ani tato změna nepomohla.
Zkusím vložit celý soubor logu. Třeba bude chyba pro Vás čitelnější.
Mám trochu obavu aby to v některých situacích nemělo vliv na chování webu a tím pádem na možnost objednat zboží.
Děkuji moc.


Přílohy:
er.rar [5.81 KiB]
270 krát
Nahoru
 Profil  
 
 Předmět příspěvku: Re: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 30 říj 2014 17:53 
C4 podpora
C4 podpora

Registrován:
30 čer 2009 09:14
Příspěvky:
8504
Dobrý den,

ale podle Error logu se již od 12:53:57 hlášení nezobrazují. I na FTP serveru máte upravenou verzi souboru nahranou v 12:54. Takže to přesně odpovídá a vypadá to, že nový kód v souboru classes/PrestaShopAutoload.php problém vyřešil.

A další chybová hlášení s tím už nesouvisí. V prvním případě:
Kód:
PHP Warning:  file_get_contents() [<a href='function.file-get-contents'>function.file-get-contents</a>]: Unable to access /data/www/ceske-ponozky.eu/www.ceske-ponozky.eu/mails/cs/pripraveno_epedice.txt ...
aplikace nemůže najít souboru mails/cs/pripraveno_epedice.txt. Soubor na serveru opravdu neexistuje, a proto se hlášení vypisuje.

A v druhém případě:
Kód:
PHP Warning:  Invalid argument supplied for foreach() in /data/www/ceske-ponozky.eu/www.ceske-ponozky.eu/modules/ulozenka/ulozenka.php on line 711 ...
chyba souvisí pravděpodobně se špatně optimalizovaným kódem modulu Uloženka.

_________________
Radek Plašil
Webhosting C4
https://www.c4.cz/


Nahoru
 Profil  
 
 Předmět příspěvku: Re: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 30 říj 2014 20:30 
C4 zákazník

Registrován:
04 říj 2011 14:37
Příspěvky:
12
Rozumím...
I tak velmi děkuji za pomoc.

Pěkný večer.
LJ


Nahoru
 Profil  
 
 Předmět příspěvku: Re: PrestaShop 1.6.0.9 - Error log - Cannot write temporary file
PříspěvekNapsal: 11 lis 2016 13:49 

Registrován:
11 lis 2016 13:46
Příspěvky:
1
Dobrý den,

jsem začátečník a měla jsem stejný problém - zkopírovala jsem vámi uvedený kód a eshop už zase funguje, hurá. Moc díky za užitečné rady!


Nahoru
 Profil  
 
Zobrazit příspěvky za předchozí:  Seřadit podle  
Odeslat nové téma Odpovědět na téma  [ Příspěvků: 6 ] 

Všechny časy jsou v UTC + 1 hodina [ Letní čas ]


Kdo je online

Uživatelé procházející toto fórum: Žádní registrovaní uživatelé a 0 návštevníků


Nemůžete zakládat nová témata v tomto fóru
Nemůžete odpovídat v tomto fóru
Nemůžete upravovat své příspěvky v tomto fóru
Nemůžete mazat své příspěvky v tomto fóru
Nemůžete přikládat soubory v tomto fóru

Hledat:
Přejít na:  
cron
FTP Uploader
Staňte se naším zákazníkem!
Hledáme kolegy
PrestaShop partneři

Seznam všech partnerů

PrestaShop Hosting
Návody pro C4

© 2009-2024 ČESKÝ WEBHOSTING s.r.o. Kontaktní e-mail: forum@c4.cz
Diskuzní fórum využívá technologie: phpBB, phpBB-SEO.com, phpBB.cz