Adventures As Me


cPanel Language Module Interfaces

Written 09 Nov 2008

Scripting languages often provide a central location to obtain modules   for use in user applications. For example, Perl has CPAN and PHP has   PEAR. cPanel 11 provides an easy to use interface for managing modules   for Perl, PHP and Ruby, both from WHM and cPanel. In this first of a   two part series, we cover these management interfaces. In the second   article we discuss a simple method of integrating these modules into   an end user application. Please note, the language modules discussed   in this series only pertain to web applications served by Apache.   These methods do not apply to applications served by cPanel (i.e.   cpsrvd).

WHM Language Module Management

Any language modules installed using the WHM interface are installed   in system directories, making them available to all applications on   the server. The interfaces allow installing CPAN modules for Perl,   PEAR packages and PECL extensions for PHP and Gems for Ruby. The Gems   interface will only be available if Ruby is installed on the server   (e.g. /scripts/installruby). A unified look is applied to each module   interface which allows an admin to:

            
  • list currently installed modules
  • list modules available on the remote repository
  • search the remote repository
  • install a module
  • upgrade existing modules
  • remove existing modules

Some special notes about PEAR and PECL: these repositories use   different 'channels', depending upon whether you want Stable, Alpha or   Beta quality packages installed. The WHM and cPanel interfaces only   use the Stable channel. Thus a module might be listed on the main site   (pear.php.net or pecl.php.net) but is not available for install within   the cPanel interfaces (or the interface lists a different version)   because only the Stable channel is sourced and displayed. PECL is a   special wrapper around PEAR that provides a simple method of   installing PHP extensions that are not provided with the main PHP   source. Some PECL packages can have issues if the working directory (the directory used to build the extension) is   on a partition marked NOEXEC, as /tmp often is.

cPanel Language Module Management

Since the Gems, PEARs and CPAN modules installed via WHM are system- wide, it's easy for a conflict to arise with what a particular end   user application needs and what is provided at the system level. The   cPanel version of the language module interfaces allow installation   direct to the user's home directory. The modules are installed in / home/user/language, where language is one of perl, php or ruby   depending. A cPanel user is presented with a similar interface, with   the same capabilities, as exists in WHM. However, the cPanel interface   provides the extra feature of displaying both modules installed   exclusive to the user's account, and those installed system-wide. Only   those installed to the user's account can be managed in the cPanel interface.

Note

Unlike WHM there is no interface for installing PECL extensions within the cPanel interface. This is for at least two reasons:

  1. A compiler, such as GCC is needed.
  2. PECL extension installation usually requires write access to the system php.ini file.

Both actions typically require privilege escalation. There is no provision within cPanel for this.

Once the particular module is installed to the user's home directory,   it is available for use in his application. However, the application   must be modified, or the environment configured, to inform the   application of the location of these modules. Each language module   management page contains example code for the particular language that   accomplishes this. cPanel 11 also contains a feature, known as   Homeloaders, that allows use of these modules without modification of   the application or environment. Our next article in this series will   discuss that feature.

Related Posts