خطأ: Fatal error: Uncaught TypeError: ftp_pwd() / ftp_nlist()

خطأ متعلق ب FTP_PWD

Fatal error: Uncaught TypeError: ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, null given in wp-admin/includes/class-wp-filesystem-ftpext.php:230
Stack trace:
#0 wp-admin/includes/class-wp-filesystem-ftpext.php(230): ftp_pwd(NULL)
#1 wp-admin/includes/class-wp-filesystem-ftpext.php(468): WP_Filesystem_FTPext->cwd()
#2 wp-admin/includes/file.php(1629): WP_Filesystem_FTPext->is_dir('...')
#3 wp-content/plugins/sfwd-lms/mu-plugins/setup.php(35): unzip_file('...', '...')
#4 wp-content/plugins/sfwd-lms/includes/class-ld-lms.php(750): include('...')
#5 wp-content/plugins/sfwd-lms/includes/class-ld-lms.php(579): SFWD_LMS->activate()
#6 wp-content/plugins/sfwd-lms/includes/class-ld-lms.php(271): SFWD_LMS->upgrade_plugin()
#7 wp-includes/class-wp-hook.php(324): SFWD_LMS->trigger_actions('')
#8 wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#9 wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#10 wp-settings.php(695): do_action('init')
#11 wp-config.php(120): require_once('...')
#12 wp-load.php(50): require_once('...')
#13 wp-admin/admin.php(34): require_once('...')
#14 wp-admin/plugins.php(10): require_once('...')
#15 {main} thrown in wp-admin/includes/class-wp-filesystem-ftpext.php on line 230
PHP

خطأ متعلق ب FTP_NLIST

Fatal error: Uncaught TypeError: ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, null given in wp-admin/includes/class-wp-filesystem-ftpext.php:438
Stack trace:
#0 wp-admin/includes/class-wp-filesystem-ftpext.php(438): ftp_nlist(NULL, '...')
#1 wp-admin/includes/class-wp-filesystem-ftpext.php(456): WP_Filesystem_FTPext->exists('...')
#2 wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/File.php(260): WP_Filesystem_FTPext->is_file('...')
#3 wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/File.php(424): Automattic\WooCommerce\Internal\Admin\Logging\FileV2\File->is_writable()
#4 wp-content/plugins/woocommerce/src/Internal/Admin/Logging/FileV2/FileController.php(135): Automattic\WooCommerce\Internal\Admin\Logging\FileV2\File->write('...')
#5 wp-content/plugins/woocommerce/src/Internal/Admin/Logging/LogHandlerFileV2.php(60): Automattic\WooCommerce\Internal\Admin\Logging\FileV2\FileController->write_to_file('...', '...', 1714377832)
#6 wp-content/plugins/woocommerce/includes/class-wc-logger.php(189): Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2->handle(1714377832, 'critical', 'Uncaught TypeEr...', Array)
#7 wp-content/plugins/woocommerce/includes/class-wc-logger.php(236): WC_Logger->log('critical', 'Uncaught TypeEr...', Array)
#8 wp-content/plugins/woocommerce/includes/class-woocommerce.php(378): WC_Logger->critical('Uncaught TypeEr...', Array)
#9 [internal function]: WooCommerce->log_errors()
#10 {main}
thrown in wp-admin/includes/class-wp-filesystem-ftpext.php on line 4
PHP

حل الخطأ باضافة الكود التالي لملف wp-config.php

//wp-config.php

define('FS_METHOD', 'direct');.

require_once( ABSPATH . 'wp-settings.php' );
PHP

ملاحظة هامة: أيضاً تأكد أن أذونات الملفات وصلاحياتها مضبوطة بشكل صحيح.