#WHMADDON:someaddon:Plugin Name
#!/usr/bin/perl
#WHMADDON:helloworld:Hello World <b>Example</b>
###############################################################################
# This is an example hello world WHM plugin feel free to modify it as you see fit
###############################################################################
# Load general use case perl modules
use lib '/usr/local/cpanel';
use Cpanel::cPanelFunctions ();
use Cpanel::Form ();
use Cpanel::Config ();
use Whostmgr::HTMLInterface ();
use Whostmgr::ACLS ();
###############################################################################
print "Content-type: text/html\r\n\r\n";
# Check user has root permissions
Whostmgr::ACLS::init_acls();
if ( !Whostmgr::ACLS::hasroot() ) {
# User is not root, tell them where to go
print "You need to be root to see the hello world example.\n";
exit();
}
# Parse input parameters from GET and POST into $FORM{} for later use
my %FORM = Cpanel::Form::parseform();
# Print a WHM Header
Whostmgr::HTMLInterface::defheader( "Hello World Example Plugin",'/path/to/logo.gif', '/cgi/addon_helloworld.cgi' );
# Print General Output
print "<p>Hello world indeed...</p>";
# End Example
1;
open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi failed at cpsrvd-ssl.pl line 5369
Internal Error: "GET /cgi/hello.cgi HTTP/1.1" Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi: Please check /usr/local/cpanel/logs/error_log for the exact error.
open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi failed at cpsrvd-ssl.pl line 5369
Internal Error: "GET /cgi/hello.cgi HTTP/1.1" Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi: Please check /usr/local/cpanel/logs/error_log for the exact error.
open3: exec of /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi failed at cpsrvd-ssl.pl line 5369
Internal Error: "GET /cgi/hello.cgi HTTP/1.1" Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/hello.cgi: Please check /usr/local/cpanel/logs/error_log for the exact error.
Chown/Chmod issuesMain
Hello World Example Plugin
Hello world indeed...
How can I add PHP to it?if you name the script prefixed with addon_ it will show in the menu, e.g.
addon_helloworld.cgi
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
![]() |
Adding custom user config key for all users | Developer Experience | 4 | |
D | Adding Drupal using cpaddon scripts | Developer Experience | 1 | |
F | adding new scripts to library | Developer Experience | 1 | |
F | Adding more addon scripts? | Developer Experience | 2 | |
F | Adding install scripts to CPanel? | Developer Experience | 1 |