[PHP] Memory

2006-10-12 Thread Doug Fulton
I'm running out of memory even though I upped it to 
memory_limit = 500M in php.ini.
Error messages and script are below.  Thanks in advance for any tips.

$ php -c /usr/local/php5/lib/php.ini createPseudoIDs.php  crosswalk.txt
php(780) malloc: *** vm_allocate(size=1069056) failed (error code=3)
php(780) malloc: *** error: can't allocate region
php(780) malloc: *** set a breakpoint in szone_error to debug
FATAL:  emalloc():  Unable to allocate 37 bytes



?php

// Create a complete mapping of SSNs to random Pseudo Keys


// Create array with all potential Pseudo Keys
$pseudoKeys = array();
for ($i=1;$i=9;$i++) {
$pseudoKeys[] = padToNine($i);
}

// Loop through all possible SSNs
$numLeft = 9;
for ($i=1;$i=9;$i++) {
$ssn = padToNine($i);
// Get random index into remaining pseudo keys
$maxRand = $numLeft-- - 1;
$randIndex = rand(0, $maxRand);
$pseudoKey = $pseudoKeys[$randIndex];
array_splice($pseudoKeys,$randIndex,1);
// Output it.
print $ssn.:.$pseudoKey.\n;
}

function padToNine($num) {

$final = '';

$cnt = strlen(strval($num));
$padding = 9 - $cnt;
for ($i=1; $i=$padding; $i++) {
$final .= '0';
}
$final .= strval($num);

return $final;
}
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] gd for php5 under RH ES4

2006-10-11 Thread Doug Fulton
I am trying to use the php gd library (for imagecreate, etc) with php5 
under Red Hat ES4.  I tried installing php-gd via webmin (which in turn, 
I see, uses up2date), but get the following error in the apache error 
log when restarting:
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php4/gd.so' - /usr/lib/php4/gd.so: undefined symbol: 
empty_string in Unknown on line 0

I don't know if the problem is that php-gd is a php4 library or there is 
something else that I need to install or do.  I saw something about 
php5-gd, but webmin/up2date can't find anything by this name.

I have searched for a bit on this without joy; any guidance is 
appreciated.  I am not a system administrator by training, but am a 
longtime Unix programmer, so I can handle reasonably low level 
instructions, if necessary.  I did post this to a Red Hat list without 
any reply so far.

Thanks in advance,
Doug

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php