note 85111 added to function.shell-exec

From: Date: Thu, 14 Aug 2008 23:59:15 +0000
Subject: note 85111 added to function.shell-exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-143510@lists.php.net to get a copy of this message
The problem described by 'concept at conceptonline dot hu' was mine too (writing the output on the Apache error log instead of returning it). But I think the cause explanation is misleading: it is not due to running script in a different path. The clue for this behaviour as Apache documentation mention is: "A very wide variety of different messages can appear in the error log. Most look similar to the example above. The error log will also contain debugging output from CGI scripts. Any information written to <i>stderr</i> by a CGI script will be copied directly to the error log." (http://httpd.apache.org/docs/1.3/logs.html#errorlog) So the most probable cause for this problem is a running script which tends to write its output on stderr instead of stdout. You cannot even capture it by piping (e.g. [command]>[output] syntax of unix). The smart trick to get rid of this situation (that can become a serious one as I experienced) is one suggested by Anatol Pomozov in his currently non-accessible weblog (I saw his post on archive.com!): You should add after your command these characters within the qoutation mark: " 2>&1" I guess it forces OS to copy stderr on stdout. ---- Server IP: 92.48.100.16 Probable Submitter: 78.105.148.69 ---- Manual Page -- http://www.php.net/manual/en/function.shell-exec.php Edit -- https://master.php.net/note/edit/85111 Del: integrated -- https://master.php.net/note/delete/85111/integrated Del: useless -- https://master.php.net/note/delete/85111/useless Del: bad code -- https://master.php.net/note/delete/85111/bad+code Del: spam -- https://master.php.net/note/delete/85111/spam Del: non-english -- https://master.php.net/note/delete/85111/non-english Del: in docs -- https://master.php.net/note/delete/85111/in+docs Del: other reasons-- https://master.php.net/note/delete/85111 Reject -- https://master.php.net/note/reject/85111 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#143510) next »