0

I have started getting an out of memory error that wasnt occurring before I changed hosts. I altered my php ini settings to add but the godaddy people pointed to this code and suggest I rewrite it. The problem I am having is I took this code from someone else who obviously has more skill than I do. It used to run just fine until I went to a godaddy host then the memory errors started coming up to my users. I just started learning php in october so my skills are not very good. I have posted questions here a long while back when I first started and everyone gave me great input. This is a game I wrote to learn php. It uses a very large detail table of records for detailed units. The errors occur when I start reading through a cron job that runs through 9 million records.

in /home/content/30/6254730/html/includes/inc-setup.php on line 35
Error 500 Internal Server Error

The code that creates the function to read the table is here

<?

/*
#
#
*/

include($incloc . "includes/inc-config.php");

class mysql {
    function connect() {
	
    	global $DB_INFO;
		
        $connect = mysql_connect($DB_INFO['hostname'],$DB_INFO['username'],$DB_INFO['password']);

        if(!$connect) {
            die("Cannot connect to mySQL Host.");
        } else {
            $select = mysql_select_db($DB_INFO['database']);

            if(!$select) {
                die("Cannot connect to DB.");
            } else {
                return $select;
            }
        }
    }

    function query($info) {
        return mysql_query($info);
    }

    function fetch($info) {
        return mysql_fetch_array($info);
    }

    function num($info) {
        return mysql_num_rows($info);
    }
	function affected() {
		return mysql_affected_rows();
	}
    function close() {
		return mysql_close();
    }
}

$db = new mysql;
$db->connect();

$mintime15	 = time() - (60*15);
$timeminus24 = time() - (60*60*24);


$gamedate = date("d-m-Y - H:i:s");

$result=$db->query("SELECT * FROM settings");
while($rowz=$db->fetch($result)){
	$x1=$rowz['sName'];
	$x2=$rowz['sValue'];
	$SETTINGS[$x1]=$x2;
}

?>

What I really dont understand is I paid for an unlimited account with godaddy and the old cheaper service that hosted didnt report any of these errors or run out of memory. Yet they tell me my code to ready the array is the problem. I just dont see it as it used to work. You people have been great in the past. If anybody has an idea of how I can avoid this out of memory problem i would appreciate it. I did set the php.ini settings higher as well... Those are below but seem fine to me...

register_globals = off
allow_url_fopen = off

expose_php = Off
max_input_time = 60
variables_order = "EGPCS"
extension_dir = ./
upload_tmp_dir = /tmp
precision = 12
SMTP = relay-hosting.secureserver.net
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=,fieldset="

memory_limit = 150M
post_max_size = 150M
file_uploads = On
upload_max_filesize = 150M 

[Zend]
zend_extension=/usr/local/zo/ZendExtensionManager.so
zend_extension=/usr/local/zo/4_3/ZendOptimizer.so
3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by honos1
0

Again I have come to the right place. I kind of understand the articles and at least now have a better idea of why this is happening. Hoping I can get the rest figured out today. I greatly appreciate this site. Thank you for the articles.

Appreciatively,

John Kleck
Honos1


http://www.cyberciti.biz/tips/http-error-500-internal-server-for-php-pages-and-solution.html

http://support.modwest.com/content/5/291/en/why-does-my-php-script-throw-an-internal-server-error-500.html

0

Through php.ini changes, you may try to avoid out of memory error.
you need to look into if godaddy allow us to make changes of these parameters using PHP.ini. When number of records in database is millions, then it is good to take a private virtual server / dedicated server.

0

I did actually begin playing with php.ini and eventually set the error reporting off completely for now. Although I like the idea of a dedicated server Godaddy has restrictions in so far as I would need to have server management experience or I would have to pay an insane amount of money to pay someone else too. Unfortunately I am not yet up to the challenge to learn Lynux as well since i just began learning php in october I am still too green. Though I am putting a plan together to get me there. So thank you. The game is working at the moment with only a few glitches I am hunting down. The lag issues I will hopefully resolve with a future server but that will take me down yet another path. Thank you for the information. It is appreciated.

Through php.ini changes, you may try to avoid out of memory error.
you need to look into if godaddy allow us to make changes of these parameters using PHP.ini. When number of records in database is millions, then it is good to take a private virtual server / dedicated server.

Edited by mike_2000_17: Fixed formatting

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.