Unable to create simple .php file for paper_lantern

electric

Well-Known Member
Nov 5, 2001
742
5
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!
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,578
53
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.
 
Last edited:

electric

Well-Known Member
Nov 5, 2001
742
5
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.
 
Last edited by a moderator:

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,578
53
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.