On Sun, Nov 24, 2013 at 1:30 PM, Tim Streater <t...@clothears.org.uk> wrote:
> I want to port my application, which runs fine under OS X, to Windows7. I > have a PHP startup script, which launches httpd as follows: > > // Now attempt to start apache > > $cmd = '/usr/sbin/httpd -f "/path/to/my/config/file" 2>&1'; > exec ($cmd, $results, $result); > > if ($result!=0) > { > // Print contents of $results array and then exit > } > > // Success in starting apache, carry on and do the next thing > > > Doing the above appears to satisfy these requirements: > > 1) start it in the background > 2) redirect stderr to stdout so that any startup errors (e.g. bad config > items) get picked up and returned in $results in case of startup failure > > What I'd like to know is whether the redirection is organised by the OS or > by apache itself - so do I do the same as above to pick up any stderr > output from apache under Win7, or is there a different mechanism? > > Secondly, is (1) above satisfied because httpd, itself, relinquishes the > console and puts itself in the background at successful startup, or is it a > side-effect of putting 2>&1 in the above? > On the backgrounding: With your invocation on Unix, httpd will background itself. Invoking httpd like that on Windows, there's no background capability. Instead, typically you install a service and can use httpd command-line options (or service tools) to manage httpd lifecycle. Another possibility if you need to avoid running as a service is to start httpd in a process you have backgrounded and have a way to whack it when you want it to stop. (The nice way is to signal the shutdown event, but there's currently no command-line option to signal it.) > -- > Cheers -- Tim > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org > For additional commands, e-mail: users-h...@httpd.apache.org > -- Born in Roswell... married an alien... http://emptyhammock.com/