Re: [PHP4BETA] flock() fails under Solaris

From: Date: Tue, 28 Mar 2000 07:09:55 +0000
Subject: Re: [PHP4BETA] flock() fails under Solaris
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-12721@lists.php.net to get a copy of this message
On Tue, Mar 28, 2000 at 08:53:37AM +0200, Andreas Jung wrote: > Take a look at the following code: > > function log_system_output($cmd,$outp,$st,$ts,$te) { > global $LOG_DIR; > > $fp = fopen("$LOG_DIR/output.log","a"); > flock($fd,2); > > fwrite($fp,"--------------------------------------------------------------------------------\n"); > fwrite($fp,"Kommando: $cmd\n"); > fwrite($fp,sprintf("Gestartet: %s Terminiert: %s Gesamtlaufzeit: > %-.3lf\n", > strftime("%Y-%m-%d %H:%M:%S",$ts),strftime("%Y-%m-%d > %H:%M:%S",$te),$te-$ts)); > > fwrite($fp,"Exitcode: $st\n"); > fwrite($fp,"Ausgabe: \n$outp\n"); > > // flock($fd,3); > fclose($fp); > > } > > > The execution of the function fails with the message: > Warning: Supplied argument is not a valid File-Handle resource in ... > When I remove the flock() call the function works as expected. please change $fd to $fp (that's your variables name;-) > > Environ: Solaris 2.7,gcc-2.95-2,PHP4RC1 > > Andreas Jung > > > -- > _\\|//_ > (' O-O ') > ------------------------------ooO-(_)-Ooo-------------------------------------- > Andreas Jung, Saarbrücker Zeitung Verlag und Druckerei GmbH > Saarbrücker Daten-Innovations-Center > Untertürkheimerstraße 15, D-66103 Saarbrücken, Germany > Phone: +49-(0)681-502-1528, Fax: +49-(0)681-502-1509 > Email: ajung@sz-sb.de (PGP key available) > ------------------------------------------------------------------------------- > > -- > PHP 4.0 Beta Mailing List <http://www.php.net/version4/> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net > For additional commands, e-mail: php4beta-help@lists.php.net > To contact the list administrators, e-mail: php4beta-admin@lists.php.net > -- Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.version4 (#12721) next »