Jump to content

[SOLVED] PHP Fatal error: Out of memory


Dtonlinegames

Recommended Posts

Hey guys bit of a long one for ya but I'm stuck  :(

I'm not getting a PHP error just a 500 server error but my error log shows this as the last entry

 

"dt-online-games.com [Tue Feb 17 23:44:32 2009] [error] [client 149.254.50.7] PHP Fatal error:  Out of memory (allocated 28311552) (tried to allocate 4864 bytes) in /home/sites/dt-online-games.com/public_html/new/includes/index.php on line 58"

 

I'm included the scripts below but I cant see anything wrong with them so any help would be most appreciated!  :)

 

<?php
$a =$_GET['action'];
session_start();
require 'defs.inc.php';
require 'sql_.inc.'.PHPEXT;
$do =new dt_constructor;
switch($a){

case 'mainform':
return $do->mainform();
break;

case 'save_site_theme':
return $do->savetheme();
break;

case 'new_user':
return $do->new_user();
break;

default:
header(''.ROOT_DIR.'');
exit();
break;
}

class dt_constructor{

private $ext_class;

function mainform(){
	$_loginform_note;
	$details =array();
	if(!LOG_STATUS){//if not logged in check for cookie from last session
		if(COOKIE_STATUS){
			$this->mini_login_form($_COOKIE['remembered'],$_loginform_note ='password');
		}//end if previously logged in cookie
		else{//if cookie isnt found echo sign up form
			$details[] ='<div style="margin-top:50px;" class="biggreytext">You submitted the username '.$_GET['u'].'</div>';
			$details[] ='<div style="margin-top:20px;" class="biggergreytext">Are you sure?</div>';
			$details[] ='<a class="biggergreytext" href="'.ROOT_DIR.'signup/?Su='.$_GET['u'].'">YES</a>';
			$details[] ='<a class="biggergreytext" href="'.ROOT_DIR.'">';
			$details[] ='NO</a>';
			echo join('',$details);
		}//end else
	}//end if log_status
	else if(LOG_STATUS){
		$tempSQLvar =new SQL_constructor;
		if($tempSQLvar->login_recorded()){
			echo $tempSQLvar->save_theme();
		}
		else{
			echo $tempSQLvar->check_user_status();
		}
	}//end if log status ==true
}//end main_form function

function new_user(){
	$this->ext_class =new SQL_constructor;
	return $this->ext_class->new_user();
}

function savetheme(){
	echo '<h1>Save Theme Function</h1>';
}
}
?>

 

Thats the main call file and these are the includes and the sql class file.

 

SQL class file (its basic because I'm building the calls at the moment)

 

<?php
session_start();
require 'defs.inc.php';
CONNECT_MYSQL;
CONNECT_DB;

class SQL_constructor{

function new_user(){
	//echo 'hello';
}

function save_theme(){
	echo 'save theme';
	return true;
}

function check_user_status(){
	echo 'check user status';
	return true;
}

function recordedlogin(){
	echo 'recorded login';
	return true;
}

function login_recorded()
	return true;
}
}
?>

 

and the definitions file

 

<?php
session_start();
require 'index.php';
require 'sql_.inc.php';
$sql_ =new SQL_constructor;
define(LOG_STATUS,$_SESSION['username'],false);
define(COOKIE_STATUS,$_COOKIE['remembered'],false);
define(PHPEXT,'php',true);

define(CONNECT_MySQL,''.mysql_connect('localhost','#######','#######').'',true);
define(CONNECT_DB,''.mysql_select_db('######').'',true);
define(ROOT_DIR,'http://www.dt-online-games.com/new/',true);
?>

 

also if its any help the files are called by Ajax

The url to the page is

 

http://www.dt-online-games.com/new

for the save theme function click the paint brush in the top right and hover over the colours and click save your colour!

 

Thanks guys if anyone could advise me i'd be one happy chappy! :)

Link to comment
https://forums.phpfreaks.com/topic/145661-solved-php-fatal-error-out-of-memory/
Share on other sites

dt-online-games.com [Wed Feb 18 00:28:04 2009] [error] [client 149.254.50.7] PHP Fatal error:  Out of memory (allocated 29097984) (tried to allocate 4864 bytes) in /home/sites/dt-online-games.com/public_html/new/includes/index.php on line 33

 

 

Still getting the same error :(

 

I tried it at some rediculous numbers when it wouldnt work at 128M haha

And I'm not getting any errors just the damned 500 ¬_¬

 

Is there nothing wrong with my code? or is it just terrible?

 

ini_set("memory_limit","300M");
ini_set ("display_errors", "1");
error_reporting(E_ALL);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.