tecwithquestion

Well-Known Member
Oct 20, 2014
61
1
58
cPanel Access Level
Root Administrator
Hello

In x3 I was using below code to find user's home dir
<cpanel PHP="loadvars()">
$homedir = $_CPANEL['USERDATA']['home'];


Can someone please tell how can I find user homedir using live.php file ?

Thanks
 
Last edited:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463

host2media

Registered
Jan 5, 2011
3
0
51
Hello,

This is still not working at my end if someone could explain more please

in x3 I used this
Code:
<cpanel PHP="loadvars()">
$HOMEDIR = $_CPANEL['USERDATA']['home'];

function get_settings() {
    global $HOMEDIR, $SETTINGS;
    $phpini= file_get_contents("$HOMEDIR/php.ini");

note that  my script works perfectly if I save it .php but header and footer will be missing and if I save it .live.php
it returns with an error

in the new paper lantern theme I tried the following :

<?php
$get_userdata = $cpanel->uapi(                // Get domain user data.
    'DomainInfo', 'domains_data',
    array(
        'format'    => 'hash',
    )
);

function get_settings() {
    global $HOMEDIR, $SETTINGS;
    $phpini= file_get_contents("$get_userdata/php.ini");

?>
but didn't work.

please advice

and is it still possible to use header and footer in .php ? what will be the code

Thank You
 
Last edited by a moderator:

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
note that my script works perfectly if I save it .php but header and footer will be missing and if I save it .live.php it returns with an error
and is it still possible to use header and footer in .php ? what will be the code
We document how to do this under "Step 2" at:

Tutorial - Create a New Paper Lantern Interface in PHP - Software Development Kit - cPanel Documentation

What specific error message are you receiving?

Thank you.
 

host2media

Registered
Jan 5, 2011
3
0
51
We document how to do this under "Step 2" at:

Tutorial - Create a New Paper Lantern Interface in PHP - Software Development Kit - cPanel Documentation

What specific error message are you receiving?

Thank you.
this is the error i am getting :

Child failed to make LIVEAPI connection to cPanel.

is there any way to keep using .php header and footer and avoid .live.php ? because my script is running perfectly when i save it .php the only thing is that its missing the header/footer , my only issue is with $HOMEDIR with live php,

please help.

thank you
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
is there any way to keep using .php header and footer and avoid .live.php ? because my script is running perfectly when i save it .php the only thing is that its missing the header/footer , my only issue is with $HOMEDIR with live php,
You could use Template Toolkit instead if you have no requirement for PHP at all:

Tutorial - Create a New Paper Lantern Interface - Software Development Kit - cPanel Documentation

Otherwise, consider sending an email to [email protected] for additional feedback on your custom script.

Thank you.