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.

WHM PHP Addon Script

Discussion in 'cPanel Developers' started by Nadeem0319, Apr 9, 2008.

  1. Nadeem0319

    Nadeem0319 Registered

    Joined:
    Apr 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    Hi,

    I was just wondering, i created a script for WHM, and i set it up. It in PHP, it works fine from the admin interface. But when i logon to that addon through a clients interface, it doesn't read the PHP... it just displays the code as if it were a txt file... So i was just wondering is there a way around this? or like PHP is just not meant to be used as for an WHM addon from both admin and client interface?


    Thanks for any help! :)
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,277
    Likes Received:
    9
    Trophy Points:
    313
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are you making a WHM plug-in or a cPanel plug-in?
     
  3. Nadeem0319

    Nadeem0319 Registered

    Joined:
    Apr 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51

    Hi, I am making a WHM plugin
     
  4. Nadeem0319

    Nadeem0319 Registered

    Joined:
    Apr 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    soo... This is not possible?
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,277
    Likes Received:
    9
    Trophy Points:
    313
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I know you can use PHP for cPanel plug-ins, and I'd be very surprised if there wasn't a WHM plug-in coded in PHP. However, I don't know enough about WHM plug-ins myself at this time to be able to assist you.
     
  6. Nadeem0319

    Nadeem0319 Registered

    Joined:
    Apr 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    51
    Hi,

    ok i got a different question now, what if i ioncube encode my PHP code, and install it into WHM. Will it still work?
     
  7. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,277
    Likes Received:
    9
    Trophy Points:
    313
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Not by default, but enabling ioncube support in WHM is very easy. Simply go to WHM -> Server Configuration -> Tweak Settings and in the Software section, set the setting for "Loader to use for internal cPanel PHP (Use oldsourceguardian for version 1.x and 2.x)" to ioncube.
     
  8. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    702
    Likes Received:
    1
    Trophy Points:
    318
    Were you able to make your PHP script work in WHM for the normal reseller users?
     
  9. Menta2K

    Menta2K Member

    Joined:
    Apr 11, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    151
    Hey i have the same problem did you found any workaround ?
     
  10. sehh

    sehh Well-Known Member

    Joined:
    Feb 11, 2006
    Messages:
    579
    Likes Received:
    5
    Trophy Points:
    168
    Location:
    Europe
  11. Menta2K

    Menta2K Member

    Joined:
    Apr 11, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    151
  12. Menta2K

    Menta2K Member

    Joined:
    Apr 11, 2006
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    151
    I just got a reply in bugzilla
    seams that its disabled by default because of security reasons.
     
  13. WebOnce

    WebOnce Well-Known Member

    Joined:
    May 20, 2004
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Lansing, MI, USA
    What I did, is I took a peek at how RVSkin did it.

    What they do, is install the 'php side' as a cpanel theme, then in the addon_<blah>.cgi, you just redirect to:

    /xfercpanel/$ENV{'REMOTE_USER'}?theme=<your theme>

    It's kinda discombobulated, but it makes it all nice and simple, really, and probably a lot less of a security risk, one would assume.

    The only problem with this is that then you're running with the permissions of the reseller instead of root perms, which could make your solutions more complicated if need be, but I'm not sure how php runs when you turn off the security stuff in WHM, so maybe it's no different. :)
     
  14. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,451
    Likes Received:
    12
    Trophy Points:
    148
    cPanel Access Level:
    DataCenter Provider
    If you do the

    disable-php-as-reseller-security=1

    route, you are running php scripts as root. Its a much much better option to xfercpanel and run them with the users uid if you can do it and still have your plugin function.
     
  15. WebOnce

    WebOnce Well-Known Member

    Joined:
    May 20, 2004
    Messages:
    53
    Likes Received:
    0
    Trophy Points:
    156
    Location:
    Lansing, MI, USA
    I figured the xfercpanel method was the better route to go. Both because it's more secure and because it's more easily 'installed'. No having to have the install script fiddle with cpanel config files. :) Thanks for letting us in on the details though. Very much appreciated.
     
Loading...

Share This Page