Fork me on GitHub

Tuesday, June 21, 2011

Making FlatPress bombproof

My last commit on SVN adds two lines to defaults.php that should make life easier for some people.

// default file permissions
// change file to 644 and dir to 755 if your webserver "complains"
define('FILE_PERMISSIONS', 0777);
define('DIR_PERMISSIONS', 0777);

From time to time, I get reports that FlatPress breaks some strict webserver configurations and users get the 500 error code.

This is because sometimes 0777 (world-writable, readable and executable for files, writable, readable, “listable” worldwide for directories) is considered unsafe.

Unfortunately, there is a reason for choosing 0777 for everything, over, say, 644 for files and 0755 for directories (another common choice).

Often, the “virtual user” under which the webserver runs, it’s not the same under which the FTP server runs. This means that a file created by the webserver cannot be deleted via FTP.

This can cause many headaches to the end-user (namely, us all), so I’ve decided to go the most straightforward way, and use 0777.

However, sometimes hosts enforce “best practice” by throwing an error when files do not respect the 0644, 0755 mantra.

I’ve added those options you see above, so that you have control over this, too. In case you need it, open your defaults.php and change FILE_PERMISSIONS to 644 and DIR_PERMISSIONS to 755 and you shouldn’t see that ugly error anymore.

Have fun with FlatPress!

Powered by

A2Hosting.jpg

Need to host your great FlatPress-powered website?

Then why not to consider our friends at A2 Hosting?

Donate!

Click here to lend your support to: FlatPress and make a donation at www.pledgie.com !

You can also buy me a gift

FlatPress is not backed-up by any company. Making a small donation will help me to keep up with the project and will make you a happier person (I swear!)

Badges