Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

Unable to create simple .php file for paper_lantern

Discussion in 'cPanel Developers' started by electric, Sep 5, 2017.

  1. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    719
    Likes Received:
    3
    Trophy Points:
    318
    Hello,

    I am trying to create a simple page for cpanel paper_lantern that will show a few PHP variables for the customer in their cpanel area.

    I read the Tutorial to Create a New Paper Lantern Interface in PHP, but it doesn't seem to be working. It just gives an error 500 when I load the page in the cpanel.

    Here is what I did:

    1. Create a new file called test.php in the "/usr/local/cpanel/base/frontend/paper_lantern" folder. (File is owned by root with permissions of 644.)

    2. Add this code, copied directly from the tutorial, to the the test.php file:

    Code:
    <?php
    include("/usr/local/cpanel/php/cpanel.php");  // Instantiate the CPANEL object.
    $cpanel = new CPANEL();                       // Connect to cPanel - only do this once.
    print $cpanel->header( "Page Heading , app_key" );      // Add the header.
    ?>
    
    <?php
    print $cpanel->footer();                      // Add the footer.
    $cpanel->end();                               // Disconnect from cPanel - only do this once.
    ?>
    3. Now go to customer's cpanel, and then replace "index.html" with test.php.

    I see an error 500.

    Any ideas what I am doing incorrectly?

    Thanks!
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,512
    Likes Received:
    32
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Hi,

    I can confirm this defect on a development build of version 68. Which version are you testing on?

    The following additional information is logged to the cPanel error_log:

    Code:
    PHP Fatal error:  Uncaught exception 'RuntimeException' with message 'There was a problem fetching the env variablecontaining the path to the socket' in /usr/local/cpanel/php/cpanel.php:146
    Stack trace:
    #0 /tmp/cpanel_phpengine.1504698776.32651cZh9hkOLY3(3): CPANEL->__construct()
    #1 {main}
      thrown in /usr/local/cpanel/php/cpanel.php on line 146
    Update: I filed this as case CPANEL-15673.
     
    #2 cPanelKenneth, Sep 6, 2017
    Last edited: Sep 6, 2017
  3. electric

    electric Well-Known Member

    Joined:
    Nov 5, 2001
    Messages:
    719
    Likes Received:
    3
    Trophy Points:
    318
    I tested this (and had the same problem) on cPanel & WHM 64.0 (build 38)

    (I see the same error in the cpanel error log.)

    The problem seems to occur even if you just rename the "integration_examples/example.live.php" file to anything else. As soon as the file is renamed (no edit of contents), it gives the error.
     
    #3 electric, Sep 6, 2017
    Last edited by a moderator: Sep 6, 2017
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,512
    Likes Received:
    32
    Trophy Points:
    308
    cPanel Access Level:
    Root Administrator
    Hello,

    The documentation is incorrect. Files must be named .live.php in order to work. We will update the documentation accordingly.
     
Loading...

Share This Page