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.

php vs cpphp vs phpcp vs livephp

Discussion in 'cPanel Developers' started by sirbrent, Aug 12, 2009.

  1. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hello,

    I have been reading a lot of documentation and have browsed the forums, but have not been able to come up with a complete picture, and have been unable to connect all the pieces.

    What exactly is the difference in how cpanel's internal apache build treats these file types: php, cpphp, phpcp, livephp? I am hoping for a comprehensive explanation.

    I understand that cpphp will parse cpanel api and then php, and phpcp will do the opposite. But my understanding ends there. Add livephp into the mix and I am now confused.

    I read the pdfs about using livephp and it seems like what I need.
    My plan is to develop cPanel plugins using php. I am confused on how to mix php and cpanel api as fluidly as possible.

    Giving my scripts the php or cpphp extension and mixing the two (php and cpanel api1/2) has, in most cases, broken my script or produced unexpected results.

    In addition to giving me an overview of how each extension is treated by cPanel's internal Apache, if someone would be so kind as to provide me some sample code (and what the appropriate file extension would be), I would be very grateful and I do well learning by example.

    For example, say I wanted to save a php variable as the contact email (cpanel account's contact email).

    my script could look something like this:

    PHP:

    $emailaddress 
    "someone@somewhere.com";

    $result "doUpdate";

    if (
    $result == "doUpdate"){

     
    //what goes here to update cpanel account's contact
     //email address to $emailaddress ???

    }

     
    #1 sirbrent, Aug 12, 2009
    Last edited: Aug 12, 2009
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,458
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    We do not use Apache internally.
     
  3. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hi, Thanks for the response.

    Okay, you don't use Apache. Whatever web server/service is used to serve the cPanel pages -- what are the differences in how it treats php, cpphp, phpcp and (especially interested in) livephp extensions.

    Also, if someone could provide some example syntax for using cpanel's APIs to accomplish the above (in original message) when mixed with php, I would be grateful.
     
  4. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Ok, this is information that should be coming in documentation form in the near future. But, in the meantime, here's a brief rundown:

    cpphp
    execute cpanel tags before php tags, so if you wanted to call an API1 function then process that data inside of a PHP script you would use this

    phpcp
    execute php tags before cpanel tags, so if you want to pull in information from a php function (f.ex. mysql database) then process via cpanel you would do it this way

    livephp
    This is merely a PHP class that does XML-API calls without actually opening an HTTP connection (see /usr/local/cpanel/php/). API1 calls will typically not return data via this method they will simply return passed/failed.
     
    #4 MattDees, Aug 14, 2009
    Last edited: Aug 14, 2009
Loading...

Share This Page