WordPress Notes

I am constantly having to make tweeks to my stupid wordpress to get permissions to work correctly, to get plug-ins to work, to get themes to display properly, to fix broken images, etc…  so i’m going to just put some notes / fixes for certain things that I have tried and actually worked because I keep repeating these over and over again on other sites/servers and always go through the same searches because I can’t quite remember.

There seems to be a shedload of information online when dealing with directory upload and create permissions that simply tell people to chmod 777 all of their directories.  And it appears that most people follow this bad advice.  Um.  Do I really need to explain to people that this is a pretty stupid idea?  Don’t do it.

COULD NOT CREATE DIRECTORY

My most recent issue was during an update I was getting a ‘Could not create directory’ error.  There were a few solutions to this that I attempted that failed, but a combination of a few solutions worked.

Basically the idea is to assign permissions to your server to create / write to directories.

Tell WordPress to use the filesystem directly — add this line to the top of your wp-config.php:

define('FS_METHOD', 'direct');

Second you need to add the proper group permissions most likely to the same that Apache is running under. To find that out try:

ps aux | grep apache

You will see the Apache user group on the left.

Now change your WordPress folder to the same user group, you can do this in a parent folder or sub folder but for sanity it usually best for parent folder, use -R to recursively do it.

chown -R www-data:www-data /path/to/wp-root-folder
(use pwd to find your path)

Thumbnails not resizing

This one is probably not a big problem for people who are using shared servers, but I built my own apache server so I have a lot of libraries that are not installed that I only discover when I have software that calls them.  One of them is PHP-GD – the graphics library for dynamically manipulating images that wordpress calls.  So I had to get that installed.

sudo apt-get install php5-gd

then restart apache

sudo /etc/init.d/apache2 restart

Info taken from: