A local installation of WordPress is a useful way of developing sites – you can muck about on your site without the world seeing the results of your experimentation.
Although you could develop your site on a remotely hosted test server, working on a locally installed version of WordPress is more private. In addition, working locally is usually quicker and more productive – you can clip along at a rapid pace even when your internet connection is patchy.
When I recently set up a localhost WordPress installation on Linux Mint 14, I encountered problems when trying to upload and activate plugins.
When the filesystem can’t be accessed directly, WordPress will ask for permission to access files via FTP. This results in a dialog like this when you try to update a plugin (or carry out similar actions):
This is problematic in a localhost install – where files are not accessed via FTP. Luckily, there’s a fairly simple solution.
Find Out the Apache User
- Create a text file called whoami.php
- Paste this into whoami.php:
<?php echo(exec("whoami")); ?>
- Save whoami.php in your localhost root (typically /var/www/ on Ubuntu or Mint)
- Navigate to http://localhost/whoami.php
- This will return the user that your instance of Apache is running under
Give the User the Correct Permissions
The easiest fix to this issue is to give file ownership of the directory holding the WordPress files to the user that is running Apache. In my case, the Apache user was www-data, and the WordPress installation in question was located at /var/www/test.
Open a terminal (ctrl+alt+t) and enter:
sudo chown -R www-data /var/www/test
Where “www-data” is the user returned by whoami.php and “/var/www/test” is the path to the folder that contains your WP installation.