Cannot update plugin in WordPress on Centos 6.5 running LAMP

I recently spun up a Digital Ocean “droplet” (VM) running Centos 6.5. The setup of the various WordPress components was fairly smooth, the only issue was that I was not able to update any plugins. Whenever I tried, I got the following error:

Unpacking the update…
Could not create directory.

The screenshot of the actual error is below:

20140604092650

After some digging about on the internet I found this link. It is caused by a file ownership issue. The folder containing your WordPress data is owned by a different user than apache web server. So when tying to update a plugin or installing a new one WordPress is unable to edit or create the relevant plugin directory. The solution is to change the permissions of the WordPress folder so that apache has ownership of them.

I ran the following command to fix the problem:

chown -R apache:apache /var/www/wordpress

Run the above command changing the path to reflect the location of your wordpress site and the next attempt to update or install a new plugin should be successful:

Unpacking the update…
Installing the latest version…
Removing the old version of the plugin…
Plugin updated successfully.

The actual screenshot of the successful update is below:

20140604133451

Happy blogging!

BackupWordPress plugin unable to write to backup folder

After creating a new site in IIS 7.5 and then installing WordPress I noticed that the BackupWordPress plugin was not working as it didn’t have permissions to write to the \wp-content\uploads\xxxxxxxxxx-backups folder. I was seing the following error appear at the top of all the pages within the Admin site:

20130502182832

This was because the php-cgi.exe process was running under the default NT AUTHORITY\IUSR account which didn’t have write permissions to the /wp-content/uploads/xxxxxxxxxx-backups directory. As I wanted to keep the configuration as secure as possible I opted to use the ApplicationPoolIdentity feature and avoid using the default NT AUTHORITY\IUSR account.

Note: When creating the WordPress site in IIS I created an application pool called WordPress.

To resolve this issue, perform the following steps:

1. Open IIS Manager, click on Application Pools and in the middle pane you will see the application pool for your site. In my case it was called WordPress. Right-click on it and select Advanced Settings:

2. Find the setting Enable 32-Bit Applications and click the drop-down box and click True. Further down, find the Identity setting and set it to ApplicationPoolIdentity and then click OK to save the settings:

20120417065550

Then click on Sites and select the WordPress site. In the Connections pane double-click Authentication:

Select Anonymous Authentication and in the Actions pane on the right side click Edit:

Then select Application Pool Identity and click OK:

On your desktop, click Start > Run and then enter CMD in the Open dialogue box then click OK to load a command prompt enter the following and hit enter:

icacls "C:\Websites\Wordpress" /grant "IIS APPPOOL\Wordpress":(OI)(CI)(RX,W)

This enables the WordPress application pool write permissions to the C:\Websites\Wordpress directory and all sub-directories including the \wp-content\uploads\xxxxxxxxxx-backups folder.

After this you will be able to load the Backups tool in WordPress and create backups using BackupWordPress on a schedule or on demand:

20130502190822