The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Making new cPanel module

Discussion in 'cPanel Developers' started by Mike St, Feb 16, 2015.

  1. Mike St

    Mike St Member

    Joined:
    Jul 21, 2014
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    So far, after reading documentation, I was able to create a module icon and upon selecting it, I was able to access my custom code shown below and the correct output was displayed.

    PHP:
    include("/usr/local/cpanel/php/cpanel.php");
    $cpanel = new CPANEL();
    echo 
    "This option is very new and will be available way later. Sorry.<br><br>";
    echo 
    "Testing... hostname: ".$cpanel->cpanelprint('$hostname')."<br>";
    echo 
    "Testing... host: ".$cpanel->cpanelprint('$httphost')."<br>";
    echo 
    "Testing... main: ".$cpanel->cpanelprint('$basedir')."<br>";
    echo 
    "Testing... userf: ".$cpanel->cpanelprint('$homedir')."<br>";
    echo 
    "Testing... user: ".$cpanel->cpanelprint('$user')."<br>";
    $cpanel->end();
    Now I'm curious as to how to modify the main apache config file within my module. Is there a way I can do this without having to resort to traditional php file I/O functions (like avoiding fopen() etc)?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,686
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    There's no API to manage Apache configuration data at this time, so you would have to update your script to manually modify individual files. EX:

    How to manually edit Apache features

    Thank you.
     
Loading...

Share This Page