Re: [PHP] Add to array problem

2005-05-16 Thread Arshavir Grigorian
mayo wrote:
I'm having a little problem adding to an array. Each time I add to an
array it wipes what was previously added. I'm using array_push().
 
$items=array();
$items=array_push($items, $_POST[whatever]);
 
I'm missing something easy.
 
thx
 

I am having a similar problem:
if (! move_uploaded_file($_FILES['userfile']['tmp_name'], $image_file)) {
   $message = Problem uploading the file: $image_file;
} else {
   $image_data = array ( path = $image_file,
 type = $_FILE['userfile']['type']);
   if (! is_array($_SESSION['image_data'])) {
   $_SESSION['image_data'] = array($image_data);
   } else {
   array_push ($_SESSION['image_data'], $image_data);
   }
}
Somehow, when I check the contents of $image_data, I get the expected 
two items + a 0 - Array entry. I have no idea what it is or where it 
gets set.

Additionally, when I print out the contents of $_SESSION['image_data'] via:
foreach ($_SESSION['image_data'] as $image_datum) {
   if (is_array($image_datum)) {
  foreach ($image_datum as $key = $value) {
 echo array: .$key.-.$value.\n;
  }
   } else {
  echo data: .$image_datum.\n;
   }
}
I get:
* data: tmp/image_dcaa588e5da9fa009e369b5715d0c1b0_23
* data: image/gif
* array: path-tmp/image_dcaa588e5da9fa009e369b5715d0c1b0_23
* array: type-image/gif
And, if the above initialization code is executed multiple times, the 
contents of $_SESSION['image_data'] are completely wiped and 
reinitialized instead instead of accumulating (array_push()).

Any help would be much appreciated.
--
Arshavir Grigorian
Systems Administrator/Engineer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] slow session_start()

2005-04-07 Thread Arshavir Grigorian
Hi,
I am getting 4-5 minute delays when I call the session_start() function 
in one of my scripts, I reduced it to a small script that just echoes 
some html, but still calling session_start() causes a major delay. My 
/tmp directory is almost empty and there is a lot of disk space. It's an 
AMD Athlon(TM) XP 3000+ with a Gig of RAM. Anyone knows what could cause 
this?

?php
session_start();
echo html\n;
echo body\n;
echo h3we are here/h3\n;
echo /body\n;
echo /html\n;
?
I am using the PHP (4.3.2) shipped with RHEL. Does RH backport fixes 
from the newer versions of PHP to their packages? Can this be the cause 
of the slowdowns I am experiencing when calling session_start()? 
Yesterday, when I was setting this site up, everything was working 
great, today it's dog slow.

Thanks for any pointers.

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


Re: [PHP] debugging modules

2005-01-25 Thread Arshavir Grigorian
Rasmus Lerdorf wrote:
Arshavir Grigorian wrote:
Hi,
I am having trouble debugging a PECL module (APC) because while I am 
able to --enable-debug when configuring the PHP course, I cannot do 
the same for APC (no such configure option). Does anyone know how to 
do that?

PHP Warning:  Unknown(): apc: Unable to initialize module\nModule 
compiled with module API=20020429, debug=0, thread-safety=0\nPHP
compiled with module API=20020429, debug=1, thread-safety=0\nThese 
options need to match\n in Unknown on line 0

You need to make install after compiling PHP with --enable-debug to 
get phpize and php-config to inherit the debug flag which will cause 
apc to be built with debug mode when you run phpize in the apc directory.

-R
What I really needed to do was to manually delete bin/php*, lib/php/ and 
include/php/ before attempting a reinstall.

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


[PHP] debugging modules

2005-01-20 Thread Arshavir Grigorian
Hi,
I am having trouble debugging a PECL module (APC) because while I am 
able to --enable-debug when configuring the PHP course, I cannot do the 
same for APC (no such configure option). Does anyone know how to do that?

PHP Warning:  Unknown(): apc: Unable to initialize module\nModule 
compiled with module API=20020429, debug=0, thread-safety=0\nPHP
compiled with module API=20020429, debug=1, thread-safety=0\nThese 
options need to match\n in Unknown on line 0

Thanks in advance for any pointers.

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