[ previous ] [ next ] [ threads ]
 From:  Manuel Kasper <mk at neon1 dot net>
 To:  Peter Curran <peter at closeconsultants dot com>
 Cc:  m0n0wall dash dev at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall-dev] Help with module interface needed
 Date:  Fri, 02 Jul 2004 23:36:07 +0200
On 02.07.2004 20:21 +0100, Peter Curran wrote:

> Thats it - any ideas?

I just tried putting a simple PHP script in /etc/inc/ext/openvpn/rc,
and sure enough, it was executed during the boot.

Note that because system.inc executes the extensions' rc file with
exec() and not passthru(), you won't see any output that your scripts
produce on the console. I think I'll change that call in the next
release (exec -> passthru) for convenience.

> Strangeley, if I run this using exec.php I just see the output of
> exec.php.  I  am sure this is a clue, but I can't see why.

This happens because we're using the CGI version of PHP in CLI mode
(to save space). Since exec.php is always invoked via the web server,
the environment variable SCRIPT_FILENAME is set to the path of
exec.php. When exec.php tries to execute a PHP script, that
environment variable is passed on, and PHP ignores the script
filename that was passed to it on the command line and uses the
contents of SCRIPT_FILENAME instead (therefore interpreting exec.php
again). I'll fix this in the next release.

However, this does not influence the boot scripts at all, as
SCRIPT_FILENAME is not set at that time.

- Manuel