• Resolved namitmhatre

    (@namitmhatre)


    While implementing it on localhost getting below fatal error:

    Fatal error: Uncaught exception ‘Exception’ with message ‘The plugin needs to access the filesystem via FTP. Please define your FTP credentials in your wp_config.php file with FTP_HOST, FTP_USER, FTP_PASS, etc.’ in /var/www/html/stg_vserv/wp-content/plugins/jch-optimize/platform/cache.php:189 Stack trace: #0 /var/www/html/stg_vserv/wp-content/plugins/jch-optimize/jch-optimize.php(153): JchPlatformCache::getWpFileSystem() #1 /var/www/html/stg_vserv/wp-content/plugins/jch-optimize/jch-optimize.php(51): jch_optimize_activate() #2 /var/www/html/stg_vserv/wp-admin/includes/plugin.php(1964): include(‘/var/www/html/s…’) #3 /var/www/html/stg_vserv/wp-admin/plugins.php(164): plugin_sandbox_scrape(‘jch-optimize/jc…’) #4 {main} thrown in /var/www/html/stg_vserv/wp-content/plugins/jch-optimize/platform/cache.php on line 189

    https://wordpress.org/plugins/jch-optimize/

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

    (@codealfa)

    Edit the /wp-content/plugins/jch-optimize/jch-optimize.php file at about line 153 where you see this line:

    $wp_filesystem = JchPlatformCache::getWpFileSystem();

    Change that to:

    try
    {
            $wp_filesystem = JchPlatformCache::getWpFileSystem();
    }
    catch(Exception $e)
    {
            return false;
    }

    Let me know if that fixes this error for you.

    Thread Starter namitmhatre

    (@namitmhatre)

    Thanks for reply codealfa!

    Getting following fatal error after updating code.

    Fatal error: Call to a member function wp_plugins_dir() on a non-object in /var/www/html/stg_vserv/wp-content/plugins/jch-optimize/jch-optimize.php on line 167

    Plugin Author codealfa

    (@codealfa)

    Did you copy the codes as I have it? Check it again. Note the ‘return false;’ line.

    You should note though that the plugin uses WordPress’s file system API to save cache files to the server. Apparently on your server the plugin can only access the file system using FTP so in order for the plugin to work on this server you will need to define the FTP_HOST, FTP_USER, and FTP_PASS values in your config file.

    Thread Starter namitmhatre

    (@namitmhatre)

    My mistake….
    After applying your fix it works perfectly fine. I tried with fresh setup.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Activating plugin gives fatal error’ is closed to new replies.