• Resolved ojuwig

    (@ojuwig)


    Hi,

    I installed the plugin and used wpterm-check.php. It succeded. But when I run wpterm, I always get the error meessage “WPTerm: unknown error. Are you allowed to run PHP program execution functions?”

    What can I do?

    Best regards

    Oliver

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author bruandet

    (@bruandet)

    Hi,

    This error is displayed when the data returned (via AJAX) by the command is empty.
    Did you try to select another PHP function for command execution in the “Settings” tab?

    Sorry, for my late reply. I was banned from the forum, since I posted links to my page. Didn’t know that and I always posted in conjunction with a support question or review. Anyway, regarding your question: I used any method, which is available. The error message is always the same for the shell command “ls”.

    • This reply was modified 7 years, 7 months ago by oliverjuwig.
    Plugin Author bruandet

    (@bruandet)

    You can try to debug it:

    1. Go to the “settings” tab, select “system” for the PHP function and save the settings.

    2. Open “wpterm.php” and locate this line:

    // Run the command:
    list( $res, $ret_var ) = @run_command( $command, trim( $_POST['exec'] ) );
    

    Right below, add this code:

    @file_put_contents( '/full/path/to/debug.txt', "-\$res = {$res}\n=========\n-\$ret_var = {$ret_var}\n" );
    

    3. Replace /full/path/to/debug.txt with the full path to the debug log you want to create (it must be writable).

    4. Go back to the terminal and enter the uname shell command.

    5. Check the debug.txt log and paste its content here.

    6. After your test, remove the line you added to the “wpterm.php” file.

    Thanks for your support. Here’s the output for the “uname” command:

    -$res = SunOS
    [-{–}-]

    =========
    -$ret_var = 0

    Plugin Author bruandet

    (@bruandet)

    I can see your problem: your server does not have the $PWD environment variable defined. WPTerm uses it to retrieve the current working directory.
    It is possible to use the pwd command instead.

    1. Search and remove this line of code:

    $command = sprintf( "ABSPATH=%s;cd %s;%s 2>&1;echo [-{-%s-}-]", $abs, $cwd, $cmd, '$PWD' );
    

    2. Replace it with this line:

    $command = sprintf( 'ABSPATH=%s;cd %s;%s 2>&1;echo [-{-$(pwd)-}-]', $abs, $cwd, $cmd );
    

    If it works, I’ll make the change to the next update of WPTerm.

    • This reply was modified 7 years, 7 months ago by bruandet.
    • This reply was modified 7 years, 7 months ago by bruandet.
    • This reply was modified 7 years, 7 months ago by bruandet. Reason: Edited because backticks in the code secion messed with the forum code tag

    Hi,

    something changed. The error message is now:

    WPTerm: error 2

    Sorry, Oliver

    debug.txt in this case:

    -$res = Array
    =========
    -$ret_var = 2

    Plugin Author bruandet

    (@bruandet)

    I can’t paste the exact command on this forum because it makes use of ‘backticks’; the forum interprets them as markdown elements.
    Here it is on pastebin: https://pastebin.com/JY9UZkww

    • This reply was modified 7 years, 7 months ago by bruandet.

    Great, works now. Thanks a lot for your support.

    Best regards

    Oliver

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Error message’ is closed to new replies.