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