Fatal error Uncaught TypeError ftp_nlist() WordPress

Error: ftp_nlist()

How to fix Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type resource in wordpress.

WordPress is the most popular CMS in the world. Most news sites, blogs use wordpress as their CMS.

In addition to the ability of the plugin which is relatively easier for users, the provision of themes is also very large and free.

You can use it as you wish. But while using the plugin, sometimes I run into problems.

Today I’m moving wordpress data from live to localhost but I’m having problems when I save plugin data.

The plugin I’m having trouble with right now is elementor. I want to change the settings to enable the safe mode option, but when I save I get an error ftp_nlist.

Overall this error is as shown in the following text:

Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type resource, null given in /opt/lampp/htdocs/alazhar/wp-admin/includes/class-wp-filesystem-ftpext.php:420
Stack trace: #0 /opt/lampp/htdocs/alazhar/wp-admin/includes/class-wp-filesystem-ftpext.php(420): ftp_nlist(NULL, ‘/opt/lampp/htdo…’)

1 /opt/lampp/htdocs/alazhar/wp-admin/includes/class-wp-filesystem-ftpext.php(438): WP_Filesystem_FTPext->exists(‘/opt/lampp/htdo…’)

2 /opt/lampp/htdocs/alazhar/wp-admin/includes/class-wp-filesystem-ftpext.php(710): WP_Filesystem_FTPext->is_file(‘/opt/lampp/htdo…’)

3 /opt/lampp/htdocs/alazhar/wp-admin/includes/file.php(1828): WP_Filesystem_FTPext->dirlist(‘/opt/lampp/htdo…’)

4 /opt/lampp/htdocs/alazhar/wp-content/plugins/elementor/modules/safe-mode/module.php(97): copy_dir(‘/opt/lampp/htdo…’, ‘/opt/lampp/htdo…’)

5 /opt/lampp/htdocs/alazhar/wp-content/plugins/elementor/modules/safe-mode/module.php(58): Elementor\Modules\SafeMode\Module->enable_safe_mode()

6 /opt/lampp/htdocs/alazhar/wp-includes/class-wp-hook.php(305): Elementor\Modules\SafeMode\Module->on_update_safe_mode(‘global’, ‘global’)

7 /opt/lampp/htdocs/alazhar/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘global’, Array) #

8 /opt/lampp/htdocs/alazhar/wp-includes/option.php(430): apply_filters(‘pre_update_opti…’, ‘global’, ‘global’, ‘elementor_safe_…’)

9 /opt/lampp/htdocs/alazhar/wp-admin/options.php(314): update_option(‘elementor_safe_…’, ‘global’) #

10 {main} thrown in /opt/lampp/htdocs/alazhar/wp-admin/includes/class-wp-filesystem-ftpext.php on line 420

There has been a critical error on this website. Please check your site admin email inbox for instructions.

Learn more about troubleshooting WordPress.

This is my experience when moving wordpress data from live to localhost. some plugins are experiencing errors and one of them is the Elementor plugin. Below I share how to fix it.

How to Fix Fatal Error ftp_nlist must be of type resource

To fix this is:

  • Open the file file “wp-config.php”
  • Add this command:
if (!defined('FS_METHOD')) define('FS_METHOD', 'direct');
  • It show like this:
Fatal error Uncaught TypeError ftp_nlist()
  • Save it.
  • Reload page again.
  • Done

I hope this Uncaught TypeError ftp_nlist article is usefull for you.

Similar Posts