AbanteCart Community

Shopping Cart Operations => Support => General Support => Topic started by: buyandsell on February 14, 2014, 01:45:38 PM

Title: Installaion Error
Post by: buyandsell on February 14, 2014, 01:45:38 PM
 I have tried to install the abantecart but found some error of configuration
 section. with this text.

Sorry, but error occurred during installation:
 OK: {"ret_code":50}
 Name  Info
2::warning
 Invalid argument supplied for foreach() in
 ......../public_html/core/lib/cache.php on line 52


 Anybody help me in this regards.
 I am waiting
 Thanks
Title: Re: Installaion Error
Post by: abolabo on February 17, 2014, 04:11:11 AM
is folder "system" and its subfolders are writable ?
Title: Re: Installaion Error
Post by: abantecart on February 17, 2014, 05:36:37 PM
Did you pass installation validation screen on first step? How and where do you install abantecart?
Title: Re: Installaion Error
Post by: smallfish on February 19, 2014, 02:59:52 AM
I also have this problem at installation screen step 3.

=======================
Sorry, but error occurred during installation:
OK: {"ret_code":50}
Name   Info
2::warning
Invalid argument supplied for foreach() in /var/www/core/lib/cache.php on line 52
=======================

I am using Debian 7.02 server with PHP-FPM Php 5.3.28
Title: Re: Installaion Error
Post by: abolabo on February 19, 2014, 04:38:55 AM
is folder system/cache writable?
try to replace file core/lib/cache.php by attached.

Title: Re: Installaion Error
Post by: smallfish on February 19, 2014, 05:59:52 AM
Yes! It is writeable.

But I have added this line. ( if(is_array($cache_files)) { )
It seems that the function glob() can't return the value (array) to the $cache_files.

It works for me to add the line : if(is_array($cache_files)) {

Thank you!

     public function __construct() {
      $this->registry = Registry::getInstance ();
      $cache_files = glob( DIR_CACHE. '*/*', GLOB_NOSORT);
      if(is_array($cache_files)) {
      foreach ($cache_files as $file) {
         //first of all check if file expired. delete it if needed
         $file_time = filemtime($file);
         if ( (time() - $file_time) > $this->expire ) {
            if (file_exists($file)) {
               unlink($file);
               continue;
            }
         }
         //build cache map as array {cache_file_name_without_timestamp=>expire_time}
         $ch_base = substr($file,0,-11);
         $this->cache_map[$ch_base] = $file_time + $this->expire;
      }
      }
     }
Title: Re: Installaion Error
Post by: abolabo on February 19, 2014, 06:09:29 AM
yes. cause is glob function result. But i can not to understand why it returns false. Can't to reproduce.. can you help me with that?
Title: Re: Installaion Error
Post by: smallfish on February 19, 2014, 06:27:30 AM
yes. cause is glob function result. But i can not to understand why it returns false. Can't to reproduce.. can you help me with that?

How can I help?
Title: Re: Installaion Error
Post by: smallfish on February 19, 2014, 06:32:00 AM
It seems that I have fixed the problem by removing character "*' in the following line.

modify    $cache_files = glob( DIR_CACHE. '*/*', GLOB_NOSORT);

to
   $cache_files = glob( DIR_CACHE. '/*', GLOB_NOSORT);

It works now.

Besides, after I have installed abantecart successfully. I also have found that there is missing "?>" in the /system/config.php file.
Please also fix it.

Title: Re: Installaion Error
Post by: abolabo on February 19, 2014, 06:43:11 AM
It seems that I have fixed the problem by removing character "*' in the following line.

modify    $cache_files = glob( DIR_CACHE. '*/*', GLOB_NOSORT);

to
   $cache_files = glob( DIR_CACHE. '/*', GLOB_NOSORT);

It works now.

Besides, after I have installed abantecart successfully. I also have found that there is missing "?>" in the /system/config.php file.
Please also fix it.

thank you a lot!

regarding closing tag.
Note:

The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include or require, so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.  (http://ua1.php.net/manual/en/language.basic-syntax.instruction-separation.php)