• Resolved theshae

    (@theshae)


    Trying out the plugin and get a fatal error on a clean install.

    Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, null given in /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/includes/UAPI.php:140 Stack trace: #0 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/includes/UAPI.php(140): json_decode() #1 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/includes/UAPI.php(168): WebFacing\cPanel\UAPI::result() #2 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/includes/Main.php(119): WebFacing\cPanel\UAPI::has_features() #3 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/index.php(59): WebFacing\cPanel\Email\Main::admin() #4 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-admin/includes/plugin.php(2314): include_once('/home/865660.cl...') #5 /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-admin/plugins.php(192): plugin_sandbox_scrape() #6 {main} thrown in /home/865660.cloudwaysapps.com/bkgmptjsqs/public_html/wp-content/plugins/wf-cpanel-email-accounts/includes/UAPI.php on line 140

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Knut Sparhell

    (@knutsp)

    Hi! This is unexpected. It seems shell_exec is available, but returns null. Then the uapi command may not be in path enironment on the server, so must use the full path. If you can edit files:

    Change line 14 of includes/UAPI.php
    private const uapi = 'uapi';//'/usr/local/cpanel/bin/uapi';
    to
    private const uapi = '/usr/local/cpanel/bin/uapi';
    If that helps, great, it explains it fully, so please get back here and I’ll try detect what’s correct for each Linux distribution and cPanel configs, ready for next version.

    Or just, or if above does not help, try add this to your wp-config.php to force try communicating over HTTP instead:
    const WF_CPANEL_SHELL_EXEC_DISABLE = true;
    and this should bring up a message (not fatal error) about whats missing. See Details page here:

    If the shell_exec function is disabled in your PHP config, add this line to your wp-config.php file:
    const WF_CPANEL_API_TOKEN = 'paste-your-api-token';
    See [Manage API Tokens in cPanel?](https://docs.cpanel.net/cpanel/security/manage-api-tokens-in-cpanel/ )

    Then og into your cPanel manuaaly, once, create an API Access Token as described, and paste it into the config line shown above, save. It should then just work. The config line can be removed later, after creating a new access token from wp-admin, “cPanel Token Management” – an automated process.

    Plugin Author Knut Sparhell

    (@knutsp)

    In 4.4.16 a null return causes the plugin to assume not on cPanel, to avoid this.

    Plugin Author Knut Sparhell

    (@knutsp)

    Also, the line to test should now be:
    public const uapi = '/usr/local/cpanel/bin/uapi';

    Plugin Author Knut Sparhell

    (@knutsp)

    A check for this is now included in v4.5.
    If that won’t work, I hope you can check that you are really hosted on cPAnel. If not, this plgin can do nothing but give a proper error message.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Getting a few Fatal Errors’ is closed to new replies.