<div>Thanks, Brian.</div>
<div> </div>
<div>The following php script works fine to start up the polipo web proxy cache program. /etc/polipo/standard.conf contains some standard config file settings. The command line parameters proxyPort, socksParentProxy, pidFile, and logFile are additional config settings passed to the polipo executable.</div>
<div><?php </div>
<div> //<br> $exec_command = 'polipo -c /etc/polipo/standard.conf proxyPort=8123 socksParentProxy=localhost:9050 pidFile=/var/lib/polipo/9050.pid logFile=/var/log/polipo/9050.log ';<br> $exec_output = '';<br>
$exec_result_string = @exec($exec_command, $exec_output, $exec_result_int);<br> $exec_output_lines = count($exec_output);<br> if (@openlog('', LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_LOCAL0)) {<br> $log_datetime = date('Y-m-d H:i:s');<br>
@syslog(LOG_INFO, "polipo started on port 8123 at " . $log_datetime);<br> @closelog();<br> }</div>
<div>?></div>
<div> </div>
<div>
<div>The following php script does not work. It hangs and has to be interrupted. If I run the same command from the shell as root it works fine. I have tried changing the foreground = yes to foreground = no and removing the & character at the end of the $exec_command but neither works.</div>
<div><?php </div>
<div> //<br> $exec_command = '/usr/local/bin/stunnel /etc/stunnel/test.conf &';<br> $exec_output = '';<br> $exec_result_string = @exec($exec_command, $exec_output, $exec_result_int);<br>
$exec_output_lines = count($exec_output);<br> if (@openlog('', LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_LOCAL0)) {<br> $log_datetime = date('Y-m-d H:i:s');<br> @syslog(LOG_INFO, "stunnel started at " . $log_datetime);<br>
@closelog();<br> }</div>
<div>?><br></div>
<div>/etc/stunnel/test.conf is as follows:</div>
<div>setuid = apache</div>
<div>setgid = apache</div>
<div>pid = /var/lib/stunnel/test.pid</div>
<div>output = /var/log/stunnel/test.log</div>
<div>foreground = yes</div>
<div>syslog = yes</div>
<div> </div>
<div>[stunnelTest]</div>
<div>accept = 7199</div>
<div>connect = 8123</div>
<div>client = no</div>
<div>transparent = no</div>
<div><br> </div></div>
<p>On Mon, May 5, 2008 at 11:15 AM, Brian Hatch <<a href="mailto:bri@stunnel.org">bri@stunnel.org</a>> wrote:<br></p>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Around 2008-05-02 12:19 -0700, Wesley Kenzie implored:<br>
<div>
<div></div>
<div class="Wj3C7c"><br>> I am having problems launching stunnel from a php "exec" command. I would<br>> like to have it launch as a server daemon and then have the exec command<br>> return control to the php script. The best I have been able to do is launch<br>
> it in foreground with a command like "/usr/local/bin/stunnel<br>> /etc/stunnel/test.conf &" but control never returns to the php script.<br>><br>> I do not want to use inetd mode, and would prefer to specify command line<br>
> arguments, but I see they are no longer available in version 4.<br><br><br></div></div>Can you show code that works for other excutables, but not stunnel,<br>plus your configuration file?<br><br>Stunnel will stop when it has no more input to send to the remote<br>
end. It could be that stunnel is hanging because its input isn't<br>closed, so it assumes it's not 'done' yet.<br><font color="#888888"><br><br><br>--<br>Brian Hatch Deja moo (n)<br> Systems and - The feeling that you've<br>
Security Engineer heard that bull before.<br><a href="http://www.ifokr.org/bri/" target="_blank">http://www.ifokr.org/bri/</a><br><br>Every message PGP signed<br></font><br>-----BEGIN PGP SIGNATURE-----<br>Version: GnuPG v1.2.1 (GNU/Linux)<br>
<br>iD8DBQFIH06zVkMj8/ymYEsRAjNmAKCeECb09c13cV9rz3Yx1SMf4W49KQCcDWBb<br>+q2h5JnGr6jmfHuvG8F7q0U=<br>=OOxW<br>-----END PGP SIGNATURE-----<br><br></blockquote></div>