Post by bewitching » Wed Feb 02, 2011 11:27 am

I have my store all set up, for the most part.
I go to sales/mail to see if I can send out a "test" email. I click on mail and it takes me directly to an error page that says:
Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/MYSITE/MYSITE.com/system/library/cache.php on line 31
Fatal error: Allowed memory size of 94371840 bytes exhausted (tried to allocate 8274861 bytes) in /home/MYSITE/MYSITE.com/system/library/cache.php on line 48
Line21-39 reads like this :

Code: Select all

public function get($key) {
		$files = glob(DIR_CACHE . 'cache.' . $key . '.*');
		
		if ($files) {
    		foreach ($files as $file) {
      			$cache = '';
				
				$handle = fopen($file, 'r');
      			
				if ($handle) {
				$cache = fread($handle, filesize($file));  <--- Line 31
	  
					fclose($handle);
				}

	      		return unserialize($cache);
   		 	}
		}
  	}
Line 41-51 reads like this:

Code: Select all

	public function set($key, $value) {
    	$this->delete($key);
		
		$file = DIR_CACHE . 'cache.' . $key . '.' . (time() + $this->expire);
    	
		$handle = fopen($file, 'w');

                                  fwrite($handle, serialize($value));   <-- line 48
		
    	fclose($handle);
  	}
I created a test customer account account earlier today and the notification was sent to me & the fake "customer" one got there too..

What SHOULD the above lines look like when functioning properly so I can "correct" them ?
Last edited by bewitching on Sun Feb 06, 2011 6:16 am, edited 5 times in total.

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by bewitching » Wed Feb 02, 2011 11:29 am

Forgot.... opencart version 1.4.9.3 fresh install
apsona-mod

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by i2Paq » Wed Feb 02, 2011 2:28 pm

Did you try our FREE search?

Have a look what it found searching for: Length parameter must be greater than.

And searching for: Fatal error: Allowed memory size.

Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by bewitching » Thu Feb 03, 2011 9:27 pm

Sorry, wasn't quite sure what I should be searching for.

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by bewitching » Thu Feb 03, 2011 10:17 pm

I tried going through all the post I found using the search inquiries you recommended. Didn't find anything in the way of help as far as this happening when the "mail" tab is clicked and it throwing the error I mentioned, but I did see a mention of the php.ini file in a few posts.

So here is a copy of my php.ini file:
magic_quotes_gpc = Off;
register_globals = Off;
default_charset = UTF-8;
memory_limit = 64M;
max_execution_time = 18000;
upload_max_filesize = 999M;
safe_mode = Off;
mysql.connect_timeout = 20;
session.use_cookies = On;
session.use_trans_sid = Off;
session.gc_maxlifetime = 12000000;
allow_url_fopen = on;

Anything in there look problematic ?

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by bewitching » Thu Feb 03, 2011 11:23 pm

and I did delete all files with the exception of index.html in system/cache
I never get an entry for cache.mail
I get cache.product
cache.zone etc etc.....
but never cache.mail
As I supposed to ?

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by bewitching » Fri Feb 04, 2011 8:12 am

bump

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by bewitching » Sat Feb 05, 2011 9:01 am

I have searched everything possible.There is NO reference to MAIL in any of the posts that mention these errors I've seen. Images, products, yes, but MAIL in reference cache, no. :bash:
I have the original opencart file in system/library/cache.php nothing has been altered or modded.
I even compared the one that I have in my opencart 1.4.9.3 install folder on my home computer that I used to install opencart via ftp. They are exactly the same, line for line. Even tried replacing via ftp the one on my site with the original, no change.
My php.ini parameters seem sufficient.
Somehow I got rid of the error for line 31, but the one for line 48 is still there.

I am comfortable changing .php files. Just tell me what is wrong/missing and a hint or something to fix this.
All e-mails that are automatically generated, like an order, the contact us form, they all work. I just cannot access the mail function thru admin area. It ALWAYS goes to a blank page( meaning not on the admin screen) and just shows the same code. I even disables the sales/contact token to see if that would help. Nope :-[
Here's a screenshot of what I see:
Image

I just need a little guidance.
Thanks in advance,
Bewitching

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by Qphoria » Sat Feb 05, 2011 11:27 am

The cache issue isn't likely related to the mail problem tho it can be stopping it.. try deleting all files in ytour system/cache folder.. then try looking through the 1.4.9.3 official bug thread for some code about changing the fwrite stuff to file_put_contents

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bewitching » Sun Feb 06, 2011 6:15 am

OMG ! After pulling my hair out for 2 days, I finally searched on my host's forum and found the issue.
I was using PHP 5.3 fast CGI
I changed it to PHP 5.3 CGI
No issues anymore "insert happy dance" :banana:

Thank you to all that tried to help.
This was a doosie for sure !

Hugs all around,
Bewitching

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by Qphoria » Sun Feb 06, 2011 9:41 am

bewitching wrote:OMG ! After pulling my hair out for 2 days, I finally searched on my host's forum and found the issue.
I was using PHP 5.3 fast CGI
I changed it to PHP 5.3 CGI
No issues anymore "insert happy dance" :banana:

Thank you to all that tried to help.
This was a doosie for sure !

Hugs all around,
Bewitching
Interesting why that would matter.. perhaps it just wasn't set up correctly with the fast way and then when moved to normal the mail stuff got fixed.. Either way its good to know

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bewitching » Sun Feb 06, 2011 10:19 pm

I do use PHP 5.3 fast CGI for my Zencart store, and have no issues.
Just one of those things I guess.
Anyways, thanks again to you Q, and others who offered advice that was helpful.
I got to poke around a ton of files and it really helped me to understand the inner workings of opencart .
Am I an expert on opencart now, NO....... informed.... YES ! LOL

Everyone have a great day & GO PACKERS, (since my Bears aren't in it..... GO NFC ! )

Considering OpenCart once again :)


User avatar
New member

Posts

Joined
Fri Jan 28, 2011 10:59 pm

Post by slawson17 » Sun Apr 10, 2011 3:16 am

I'm also getting somewhat of the same error. I contacted my hosting provider and they said I'm running standard CGI, so Bewitching's resolution doesn't work for me...

This is the error I'm getting when trying to access the "mail" page under "sales" in the admin area...

"Warning: fread() [function.fread]: Length parameter must be greater than 0 in /home/MYFOLDER/MYFOLDER/MYFOLDER/system/library/cache.php on line 31
Notice: unserialize() [function.unserialize]: Argument is not a string in /home/MYFOLDER/MYFOLDER/MYFOLDER/system/library/cache.php on line 36"

Does anyone have any ideas as to why I'm getting this error? I haven't touched any of the files in the system folder so I'm not sure why its not working =/ Thanks in advance :)

User avatar
Newbie

Posts

Joined
Fri Mar 11, 2011 8:12 am
Who is online

Users browsing this forum: No registered users and 300 guests