Avatar of XK8ER
XK8ER
Flag 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

PHP

Avatar of undefined
Last Comment
fcardinaux

8/22/2022 - Mon
agamal

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

"Set the memory limit to a higher value in php.ini         "
agamal

remember to restart the web server IIS or Apache
ASKER CERTIFIED SOLUTION
fcardinaux

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes