Webmin APIs for Other Programming Languages
Even though most Webmin modules are written in Perl, it is possible to use other languages to write CGI programs that run under the Webmin webserver. In order to make this easier, other people have started porting the web-lib.pl API to other languages, like Python and PHP.A Python implementation of the Webmin API is available, developed by Peter Åstrand. Currently this is still under development.
A PHP replacement for web-lib.pl is also available, developed by Nicolas Faurant nicolas.faurant@caramail.com. I'm not sure what the devlopment status of this API is at the moment.
To write Webmin CGI scripts in PHP, you must do the following :
- In all your .cgi scripts, start with #!/usr/bin/php or #!/usr/bin/php4 instead of #!/usr/bin/perl. If you use Debian Sarge, with php4-cgi package version 4.3, you must use #!/usr/lib/cgi-bin/php4 instead of #!/usr/bin/php4. /usr/bin/php4 is the CLI version of PHP4, and so can't be used to run PHP web scripts. If your scripts are not executed but only "No input file specified." is displayed, you need to set cgi.fix_pathinfo=1 in /etc/php4/cgi/php.ini.
- Include web-lib.php and template.inc in your source, instead of a "do '../web-lib.pl';"
- Add the 'lib_' prefix to each web-lib function. (e.g. call lib_init_config(); instead of &init_config(); )
- If you get a PHP security alert (which talks about force-cgi-redirect),
then you should add the following lines to your php.ini:
cgi.force_redirect=1
cgi.redirect_status_env="MINISERV_CONFIG"

