From: Yohanes A. G. <lie...@ya...> - 2002-10-08 08:58:49
|
i'm a newbie and i'm trying to create a site that can function like webmin only i'm going to use php? is it possible to create something simillar to webmin from php? if it is then can anyone give me any hint how can I call webmin's function from php? or do i have to create my own modules under php? |
From: Joe C. <jo...@sw...> - 2002-10-08 09:49:04
|
Got three years to spare? ;-) (Webmin has been under serious development for at least that long...) To answer your question more seriously: If you have to ask these kinds of questions, you're not going to have the skills needed to reinvent even a small part of Webmin for some time to come, regardless of the language used. A serious PHP /and/ Perl hacker with some C skills could probably come up with appropriate glue to allow you to write integrated Webmin modules in PHP given enough time and inclination. I'm pretty sure the easier path is simply to learn perl well enough to write your module(s) in the language that Webmin currently uses. You'll find Perl to be not much different than PHP, when it comes down to the actual gritty bits that do all the work--some things will be easier, while other things will be harder. Depending on your programming experience, and enthusiasm, you could potentially be writing reasonably good module code in under a month (that's about how long it took me to start writing real useful modules--nothing like Jamie's best modules, but not entirely ugly, either). That said, if you really, /really/ must go about it this way, you have a couple of choices: Setup Webmin to run under Apache. This will allow you to run PHP programs alongside Webmin. You'll then need to teach your PHP modules how to deal with ACLs from Webmin, and will also have to have all of the normal Webmin files (config.info, module.info, etc.). This isn't really writing a Webmin module in PHP, but it will look roughly like a Webmin module, and depending on how clever you are with PHP you can probably make it act extremely similar to a Webmin module. Start with some other similar project that is already written in PHP. There are a few out there, I'm sure. Everybody and his brother who has learned a few lines of PHP has had the same thought: "This is easy! I could write a cool program to do ________." A few of them have probably even gotten some working code out there. So look for something that addresses some or all of your needs, and build from there. You won't find anything even approaching Webmin's functionality, but maybe you don't need all of the functionality of Webmin for your project. In all cases, beware of security issues...It is real easy to build something that will allow any random user to own your server. Yohanes Adi Gunawan wrote: > i'm a newbie and i'm trying to create a site that can function like webmin > only i'm going to use php? > is it possible to create something simillar to webmin from php? > if it is then can anyone give me any hint how can I call webmin's function > from php? > or do i have to create my own modules under php? -- Joe Cooper <jo...@sw...> Web caching appliances and support. http://www.swelltech.com |
From: Sandro D. <san...@ti...> - 2002-10-09 01:06:44
|
> That said, if you really, /really/ must go about it this way, you have a > couple of choices: > > Setup Webmin to run under Apache. This will allow you to run PHP Is it really needed? I read no mention about it! (nor I understand it!) while I managed to use w/ success webmin.py (python library, used only to test the example), I was not able to run any example in php. I'd like to know if somebody knows of a module written in php, the author of web-lib.php (Nicolas Faurant) did not write an e-mail in the file, and provided no examples, please, if you read this, let us know... Here is the misbehaviour: If the php script contains #!/usr/bin/php4, that same string will be output to the browser and a warning will be issued: Warning: Cannot add header information - headers already sent by (output started at /usr/share/webmin/uptimephp/index.cgi:2) in /usr/share/webmin/web-lib.php on line 25 if '-q'(quiet) option is used, no header is issued by php4 and "no input specified" appears in the browser. I have no problem w/ cgi scripts in bash, tcl, python, awk... what has php special? Thanks in advance for any reply sandro *:-) -- Sandro Dentella *:-) e-mail: san...@ti... http://www.tksql.org TkSQL Home page - My GPL work |
From: Joe C. <jo...@sw...> - 2002-10-09 05:13:22
|
Sandro Dentella wrote: >>That said, if you really, /really/ must go about it this way, you have a >>couple of choices: >> >>Setup Webmin to run under Apache. This will allow you to run PHP > > > > Is it really needed? I read no mention about it! (nor I understand it!) > > while I managed to use w/ success webmin.py (python library, used only to > test the example), I was not able to run any example in php. Whoah! I had no idea web-lib had been ported to PHP. I knew there was a Python port, though. I didn't even know PHP could be run standalone (I thought it had to have a module in the webserver...shows how much I know about PHP). In that case, it looks like maybe an issue with Webmin not treating it as an executable, perhaps? Have you tested to be sure it runs correctly from the command line? And have you checked the PHP web-lib routines that you're using to make sure they are correct? It appears to be a 'quick' port...I don't know that I would expect it to work perfectly from the get go. -- Joe Cooper <jo...@sw...> Web caching appliances and support. http://www.swelltech.com |
From: Sandro D. <san...@ti...> - 2002-10-09 10:27:36
|
> Have you tested to be sure it runs correctly from the command line? Sure I did it. > And have you checked the PHP web-lib routines that you're using to make > sure they are correct? It appears to be a 'quick' port...I don't know > that I would expect it to work perfectly from the get go. Not at all, my trial script -php.cgi-, is as simple as: #!/usr/bin/php4 -q <?php echo "Content-type: text/html\n\n" ; echo "Ciao\n"; ?> note that the following shell script -sh.cgi-, just works: #!/bin/sh echo Content-type: text/html echo echo Ciao The php scripts works from command line, but from inside webmin returns "No input file specified" If you take off the "-q" switch in '#!/usr/bin/php4" php4 will issue a header (X-Powered-By: PHP/4.1.2 \nContent-type: text/html), the script executes but the line with '#!...' staff is echoed to the browser... I think this has really to do with something in the way miniserv.pl deals with cgi scripts. Since I saw quite a lot of other people asking these questions on php list, it would be really nice to get an answer from people that understand how miniserv.pl works. Thanks in advance. And of course thanks to Jamie for Webmin that makes so easy to let people administer their boxes... sandro *:-) -- Sandro Dentella *:-) e-mail: san...@ti... http://www.tksql.org TkSQL Home page - My GPL work |
From: Sandro D. <san...@ti...> - 2002-10-09 15:30:15
|
After some hours studying env variables set by apache and miniserv, I understood it: miniserv.pl does not set SCRIPT_FILENAME to the complete name of the cgi script. It it sufficent to add: $ENV{"SCRIPT_FILENAME"} = $full; somewhere aroung line 1300 depending on your webmin release, where all environment variables are defined and php will work correctly..., that is to say, it does not issue any "#!/usr/bin/php4" to the browser and phpinfo() works. Now we can have a look at web-lib.pl! Should someone know of a module developed with this library, please let me know. sandro *:-) -- Sandro Dentella *:-) e-mail: san...@ti... http://www.tksql.org TkSQL Home page - My GPL work |
From: Joe C. <jo...@sw...> - 2002-10-09 22:18:33
|
Good to hear you got it figured out. I ran out of ideas about two seconds after you said "php". ;-) Does this change break standard Webmin modules? Sandro Dentella wrote: > After some hours studying env variables set by apache and miniserv, I > understood it: miniserv.pl does not set SCRIPT_FILENAME to the complete name > of the cgi script. It it sufficent to add: > > $ENV{"SCRIPT_FILENAME"} = $full; > > somewhere aroung line 1300 depending on your webmin release, where all > environment variables are defined and php will work correctly..., > that is to say, it does not issue any "#!/usr/bin/php4" to the browser and > phpinfo() works. > > Now we can have a look at web-lib.pl! Should someone know of a module > developed with this library, please let me know. > > sandro > *:-) > > > -- Joe Cooper <jo...@sw...> Web caching appliances and support. http://www.swelltech.com |
From: Sandro D. <san...@ti...> - 2002-10-10 13:21:37
|
> > of the cgi script. It it sufficent to add: > > > > $ENV{"SCRIPT_FILENAME"} = $full; > > On Wed, Oct 09, 2002 at 05:17:35PM -0500, Joe Cooper wrote: > Good to hear you got it figured out. I ran out of ideas about two > seconds after you said "php". ;-) > > Does this change break standard Webmin modules? I guess it does not, everything seems to work. Jamie, Can we ask this variable being added in miniserv.pl in future releases? sandro *:-) -- Sandro Dentella *:-) e-mail: san...@ti... http://www.tksql.org TkSQL Home page - My GPL work |
From: Jamie C. <jca...@we...> - 2002-10-10 13:32:55
|
Sandro Dentella wrote: >>> of the cgi script. It it sufficent to add: >>> >>> $ENV{"SCRIPT_FILENAME"} = $full; >>> >>> > > On Wed, Oct 09, 2002 at 05:17:35PM -0500, Joe Cooper wrote: > >>Good to hear you got it figured out. I ran out of ideas about two >>seconds after you said "php". ;-) >> >>Does this change break standard Webmin modules? >> > > I guess it does not, everything seems to work. Jamie, Can we ask this > variable being added in miniserv.pl in future releases? No problems .. I've already put it in. - Jamie |
From: Wil C. <wc...@na...> - 2002-10-11 02:44:01
|
On Tue, 2002-10-08 at 22:12, Joe Cooper wrote: =20 > Whoah! I had no idea web-lib had been ported to PHP. I knew there was=20 > a Python port, though. I didn't even know PHP could be run standalone=20 > (I thought it had to have a module in the webserver...shows how much I=20 > know about PHP). Anyone know how far along this project it? I'd really love to develop with Python, but the last time I looked, it was nowhere near completion. Wil --=20 Wil Cooley wc...@na... Naked Ape Consulting http://nakedape.cc * * * * Linux, UNIX, Networking and Security Solutions * * * * QCSNet http://www.qcsn.com * * * * T1, Frame Relay, DSL, Dial-up, and Web Hosting * * * * |
From: Jamie C. <jca...@we...> - 2002-10-11 03:53:22
|
Wil Cooley wrote: > On Tue, 2002-10-08 at 22:12, Joe Cooper wrote: > > >>Whoah! I had no idea web-lib had been ported to PHP. I knew there was >>a Python port, though. I didn't even know PHP could be run standalone >>(I thought it had to have a module in the webserver...shows how much I >>know about PHP). >> > > Anyone know how far along this project it? I'd really love to develop > with Python, but the last time I looked, it was nowhere near completion. Have a look at http://www.cendio.se/~peter/python-webmin/ I'm not sure how far along it is though .. - Jamie |
From: Sandro D. <san...@ti...> - 2002-10-11 06:37:30
|
On Thu, Oct 10, 2002 at 07:43:55PM -0700, Wil Cooley wrote: > On Tue, 2002-10-08 at 22:12, Joe Cooper wrote: > > > Whoah! I had no idea web-lib had been ported to PHP. I knew there was > > a Python port, though. I didn't even know PHP could be run standalone > > (I thought it had to have a module in the webserver...shows how much I > > know about PHP). I tried it and it seem to work, not all functions have been ported but this is not a real problem. It needs python2.2: I had problems w/ python 2.1 and the author suggested me to use 2.2. Yesterday I noticed that it doesn't work if you have texttitles defined (no matter if is 0 or 1), but it shouldn't be difficult to fix it. It you download the tarball you'll see an example of a (very little) module. sandro *:-) -- Sandro Dentella *:-) e-mail: san...@ti... http://www.tksql.org TkSQL Home page - My GPL work |