As saidyjade mentioned below, printer_list crashes Apache when you pound the resulting array too much. I don't know why this happens, somebody should look deeper into the subject...
I have found out, contrary to saidyjade, that also just getting the NAME attribute (and remember, it's case-sensitive! :-) can crash Apache.
Here's what I had:
<?php
foreach (printer_list(PRINTER_ENUM_CONNECTIONS) as $printer)
echo "<option value=\"" . addslashes(strtoupper($printer["NAME"])) . "\">" . strtoupper($printer["NAME"]) . "\n";
?>
This snippet worked alright, whereas
<?php
foreach (printer_list(PRINTER_ENUM_CONNECTIONS) as $printer)
echo "<option value=\"" . addslashes(strtoupper($printer["NAME"])) . "\"" . ((strtoupper($printer["NAME"])) ? " selected" : "") . ">" . strtoupper($printer["NAME"]) . "\n";
?>
crashed Apache everytime the page was loaded.
I played around a bit and found this snippet not crashing:
<?php
foreach (printer_list(PRINTER_ENUM_CONNECTIONS) as $printer)
{
$curprin = strtoupper($printer["NAME"]);
echo "<option value=\"" . addslashes($curprin) . "\"" . (($curprin == $user["drucker"]) ? " selected" : "") . ">$curprin\n";
}
?>
So, in essence you just need to be careful about how much you use the array and if necessary define help variables that you can use as much as you want.
Hope this saves somebody some more minutes...