brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: FS_METHOD in wp-config stops the surprise FTP prompt on updates

Wp-Config
~/tips/tip-wp-config-fs-method

ls -ld wp-content wp-content/plugins index.php

Writes plugin updates directly to disk when ownership allows it.

You click update on a plugin and WordPress asks for FTP credentials you’ve never had. It does that when the files it creates would have a different owner from its own files.

WordPress tests this by writing a temporary file. If the owners differ, it falls back to FTP or SSH. First check ownership, since that is usually the real fault:

ls -ld wp-content wp-content/plugins index.php

When the web server user is meant to manage these files and the permissions are sane, you can tell WordPress which method to use. Add this above the line that says to stop editing:

define( 'FS_METHOD', 'direct' );

Updates and installs now write straight to the filesystem. The other accepted values are ssh2, ftpext and ftpsockets.

I wouldn’t use it to paper over a mess. The constant skips the ownership check; it grants no permissions. If the web user can’t write, updates now fail with a copy error in place of the prompt. And if it can write only because everything is set to 777, you have a bigger problem than a popup.

Think about shared servers as well. With direct writing, new files belong to whatever user PHP runs as, which on a badly separated host could be the same user for several sites. On your own server or container with one site per user, that is generally fine.

Further reading: WordPress developer docs: wp-config.php

More Wp-Config tips define( 'WP_TEMP_DIR', '/var/www/example.com/tmp' ); define( 'CONCATENATE_SCRIPTS', false ); define( 'CORE_UPGRADE_SKIP_NEW_BUNDLED', true ); define( 'ALTERNATE_WP_CRON', true ); wp config list WP_DEBUG All Wp-Config tips (7) All topics

Link