Creating CGI Scripts in cPanel
Building CGI applications can be a fast and flexible solution for working within cPanel. Working around limitation of perl versions, standard CGI scripts are quite useful.
To get started with the CGI scripts, there are few basics to cover. Scripts should be located in the path /usr/local/cpanel/base/3rdparty/. Permissions should be set so that the user can execute but it is not writable with global permission. If not located in the correct directory, the files will only be downloadable and not executable. To access the script, navigate to $IP:2083/3rdparty/scriptnamed.cgi. During execution, the permissions are limited by the user that initiates.
Now if you are trying to use cPanel APIs within CGI scripts, there are a few options. You can use the cPanel::XML module to implement XML-API calls while bypassing HTTP altogether. XMLs API’s Fast Mode can be used with cpanel_fast_exec to initiate a perl interface into API1 and API2 from outside cPanel. This mimics the use of fast mode. Here is an example of calling a list email addresses:
Now the $xml is a hash reference containing the information returned by the call.
Another way to access the APIs are through the JSON API. This is using javascript to manage the communications. The session is already authenticated so this is an easy way to go.
Related Posts
- 16 Great Contact Forms
- 7 Free CSS Editor Options
- What is Fantastico de Luxe?
- 8 Wordpress Ratings and Polls Plugins
- Do you Need a Virtual Private Server?
















