Hi,
    I'm trying to execute a Webmin 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! potentially dangerous but good!)

Now the STRANGE problem: (seems to be some env variables (maybe I'm wrong)
when executing PHP as CGI...)

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 interface, so to solve the problem I've
first to understand WHY php does not work...

---------------------

Maybe I can better explain with 2 samples:

> file aaa.cgi
>
>     #!/bin/bash
>     echo "Content-type: text/plain"
>     echo
>     echo "aaa"
>     touch /home/test.txt

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

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 as user root), they behave
differently:
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
file...

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
>
>     #!/bin/bash
>     /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
>
>     #!/bin/bash
>     /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...
prakash


-- 
PHP General Mailing List (http://www.php.net/)
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