Link to home
Create AccountLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

error allowed memory size

hello there,
I keep getting this error after a while of scanning the pages of my forum for working links..
the line 79 is $pagel = curl_exec($ch); which i posted the function bellow


Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 39472634 bytes) in /var/www/html/file.php on line 79
function curl($link, $post='0')
{
		global $pagel;
    if($fgc == 1)
	{
        file_get_contents($link);
	}
    else
	{
				$ch = curl_init($link);
				curl_setopt($ch, CURLOPT_URL, $link);
				curl_setopt($ch, CURLOPT_HEADER, 0);
				curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
				curl_setopt($ch, CURLOPT_TIMEOUT, 20);
				curl_setopt($ch, CURLOPT_FAILONERROR, 1);
			if(eregi("megashares\.com" , $link))
			{
				$strCookie = realpath(dirname($_SERVER['SCRIPT_FILENAME'])) . "/cookies.txt";
				curl_setopt($ch, CURLOPT_COOKIE, 1);
				curl_setopt($ch, CURLOPT_COOKIEJAR, $strCookie);
				curl_setopt($ch, CURLOPT_COOKIEFILE, $strCookie);
      }
				curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
				curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 
		if($post != '0')
		{
				curl_setopt($ch, CURLOPT_POST, 1);
				curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
		}
				$pagel = curl_exec($ch);
				return($pagel);
				curl_close($ch);
				unset($pagel);
				unset($ch);
	}
}

Open in new window

Avatar of agamal
agamal
Flag of United Arab Emirates image

http://www.howtoforge.com/forums/showthread.php?t=23101&highlight=Allowed+memory+size

"Set the memory limit to a higher value in php.ini         "
remember to restart the web server IIS or Apache
ASKER CERTIFIED SOLUTION
Avatar of fcardinaux
fcardinaux
Flag of Switzerland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer