Simple Upgrade Tip: It's not the permissions, it's the owner

Permalink
Today as I tried to upgrade from 5.6.0.2 to the 5.6.1.2, I got a page full of errors when I hit download.

They were from file.php basically saying "failed to open stream: Permission denied" and pointed to line 71 from file.php.

After much fiddling with file permissions for the /updates folder which had no effect, I remembered that Apache is running as the user 'Daemon' not Bitnami.

It's a simple thing, but the OWNER of the /updates folder is BITNAMI while the Apache web service is DAEMON.

So in my case I navigated to the htdocs folder and, whilst logged in as root and typed: chown daemon updates

Once ownership was changed, went back to the dashboard and the download button worked without error. Up came the screen reminding me to first backup my database (done that, thanks) and a button press later brought me up to 5.6.1.2

 
JohntheFish replied on at Permalink Reply
JohntheFish
That is an an absolutely excellent point which is often overlooked.

When you are used to a web host where the Apache server also owns the ftp access, its easy to forget that some hosts are just not helpful in that way.

When you have time you should write it up as a howto. Keeping a similar title should get attention from those searching.
jasteele12 replied on at Permalink Reply
jasteele12
Actually it's still permissions and rarely that simple. I'd hazard a guess that most people do not have root access (although I haven't seen any "concrete" statistics as to shared hosting vs dedicated/VPS/etc) for concrete5 installs.

There are many different ways that Apache (as well as other servers) and PHP can be configured and it seems the common (often wrong) answer is change permissions to 755 or 777 for write access (a security no-no in most cases).

You didn't post your actual platform, but you probably could have chmod o=rwx updates (not requiring the root access to chown) since BITNAMI could be an other. Or BITNAMI could be in the same group as Apache and chmod g=rwx updates would also work.

Just to clarify I'll throw in some examples for just the webserver to be able to read a file to serve:

Dreamhost: PHP is user, group needs no rights, directories need o=x (but no o=r) and o=r for files. Command line needs nothing but user rights.

Bluehost: g=rx,o=rx for directories

Pair: group no rights needed, directories u=rwx,o=rx (mod_php runs as user nobody)

These can also vary based on (F)CGI, mod_php, safe mode, Suhosin and basically however the root user decides to setup users, groups and other.

I haven't done a non-manual upgrade in quite a while (prefer symlinks without users being able to mess up their sites), but it sounds like there should be an is_writeable() check in there somewhere.

I agree with JohntheFish, this could make a good howto, but even if you don't you could post in the forums with [SOLVED] in the title and give details on the particular setup you ran into this problem on. Might be something to talk to the Bitnami folks about also, since it could help other users that haven't made it here yet.

Keep rocking the c5 :)