Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't WordPress access the file system?

Tags:

php

wordpress

A client informed me that any time he tries to update a plugin, he gets an error:

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

I don't have FTPd setup on the server, but this seems like a basic permissions issue, right? I've never had to use FTP credentials to update any other WordPress installations.

Well, I did some reading and started messing with permissions and long story short, out of frustration, I eventually made everything writeable by everybody:

sudo chmod -R 777 src

But I'm still getting the same error. So it has to be some type of configuration issue, right?

I ran a few find . -exec grep commands to determine if there is a hard-coded document root (like in Joomla), but I came up empty handed.

  • Do I really have to install FTPd to be able to update WordPress from the admin interface?
  • Is there a config file somewhere that specifies the document root location?
  • Is there some other configuration option that I'm missing here?

Or maybe it's something in the database? The site was originally on a shared host but was moved to a DigitalOcean VPS a month or so ago.

like image 457
Ben Harold Avatar asked Nov 16 '15 22:11

Ben Harold


People also ask

How do I fix file and folder permissions in WordPress?

Fix File and Folder Permissions in WordPress Using FTPOnce connected go to the root folder of your WordPress site. After that select all folders in root directory and then right click to select 'File Permissions'. This will bring up the file permissions dialog box. Now you need to enter 755 in the numeric value field.

How do I change permissions on a WordPress file system?

You can change WordPress file and directory permission either through cPanel, FTP, or SSH. Using either cPanel or FTP, navigate to the file in question, right-click, and set the permissions desired. If you are using SSH, you can use the chmod command to set the permissions.


1 Answers

I was able to force WordPress to use the filesystem instead of FTP by setting the FS_METHOD constant in wp-config.php:

 define('FS_METHOD', 'direct');

More details can be found in the WordPress codex.

like image 186
Ben Harold Avatar answered Sep 24 '22 15:09

Ben Harold