Had a real adventure getting a WordPress site going on a CentOS 5.8 LAMP server. It came down to two major areas: packages and permissions.
I asked the hosting provider to install pretty much just the base package group, knowing we could easily add on from there without having a lot of extra fluff. After a fair amount of troubleshooting (and very patient help from the site developer), I ended up installing the list below. Some of them may be unnecessary in the end, and many were pulled in as dependencies, but we got there.
Also, I had to run ‘
pecl install imagick‘. Newer versions of WordPress require PHP 5.2 and newer. CentOS provides 5.1 by default, but Red Hat back-ported 5.3 as php53 to accommodate the fact that so many things need it. One major discovery was that image resizing will break without ‘gd’ support. This came thru the php53-gd package, as well as the ImageMagic stuff.
Permissions, ownership, etc.
Like many web hosting setups, the apache user needs to be able to read directories, execute files, and in some cases write things. After lots of trial and error, we settled on these principles:
- The directory
wp-content(and its subdirectories) is owned by the site user, and is in the apache group
- The site owner is a member of the apache group as an additional group (i.e.
usermod -a -G apache user). You could also just make the apache group the primary group of the site user (
usermod -g apache user).
- All directories under wp-content are setgid (
chmod g+s), and are mode 775.
- All files are mode 664 (644 if you’re a bit paranoid, and for all .php files, but keep an eye out for things that break).