Thank you for your prompt reply...

    The problems seem to be some env variables (maybe I'm wrong) when
executing PHP as CGI...
I better explain with 2 samples:

file aaa.cgi

    echo "Content-type: text/plain"
    echo "aaa"
    touch /home/test.txt

file bbb.cgi

    #!/usr/local/bin/php -q
        echo "Content-type: text/plain\n\n";
        echo "aaa\n";
        $fd = fopen("/home/test.txt","w");

Now, the 2 programs are quite the same... (if test.txt does not exist...)
But, the 2 programs behave the same way only if you execute them _from
command line_.
If you execute them from the Webmin interface (very good for remote
administration, that lets execute programs with user root), they behave
aaa.cgi is the same, displays "aaa" on the remote web-browser, and creates
(well, if text.txt doesn't exist) a local file.
bbb.cgi does nothing, sends no http headers, no aaa, and does not create the

It seems that PHP needs some env variables, and without them, it suddenly
stops without parsing the file... am I right ?!?

I've also tried to escape from this problem (until understood and solved)
with a third program:

file ccc.cgi

    /usr/bin/at -f /path/bbb.cgi now+1minute
    touch /home/test2.txt

If I call ccc.cgi from Webmin and then from command line, the 2 executions
are scheduled properly, and look really the same (root user,same
program,...) but the task scheduled from Webmin is not executed properly...
the php seems to stop with no output.

Also with a file like this:

file ddd.cgi

    /path/bbb.cgi 2>&1 > test3.txt

show that php really has no output on stdout or stderr (test3.txt is
created, but 0 bytes long when invoked from Webmin!)

So, the BIG problem is: if Webmin can execute all programs, running them as
root, WHY doesn't work well with php scripts ?!?
I think that the PHP need something, and not having it it suddenly stops...
but what ?!?

Are there some developer that can help ?!?

(Writing Webmin modules in perl is not good, if you work mainly with php,
and webmin can be the best remote administration utility...)

thanks to all,
    waiting for some news...

> Ok, this is not really clear to me. Does it do anything? perharps give an
error ??
> Did you try writing all output to a file, so you can actually see the
error ??
> for example:
> ls  2>&1 > /tmp/out
> will write 'ls' his stdout AND stderr to /tmp/out
> Maybe, do you need to include the full path to your php binary ??

> >Hi,
> >    I'm trying to let Webmin execute a script where I can use php as
scripting language... (It will be good to work with a language as php in a
remote administration server, as root!)
> >
> >Now the STRANGE problem:
> >
> >When I execute a test.cgi program from Webmin, it's executed as root, as
it was from command line... that's good. The problem is that Webmin execute
well _every_ program I tried , EXCEPT php !
> >
> >It seems that php needs some env variables to work well, and these
variables aren't provided from the Webmin program, so to solve the problem
I've to first understand WHY php does not work...
> >
> >Here are some tests:
> >
> >1) Executing a php that produce some output, or create a file works only
when called from a login shell, not in Webmin
> >2) Executing a script that invoke "at" with the previous script doesn't
work as well... from atq the scheduled processes are the same, but the one
invoked from a login shell works, the invoked from Webmin not at all...
> >
> >... what to do ?!?
> >
> >thanx very much,
> >    prakash
> >
> >
> >

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to