1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-22 13:45:02 +00:00

Send content-type: text/plain when erroring out 'cause we can't write to disk

This commit is contained in:
Starbeamrainbowlabs 2020-02-04 01:23:44 +00:00
parent b50e7bbbf2
commit 1d540d3d8a
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -37,6 +37,7 @@ if(!file_exists($settingsFilename)) {
$settings->secret = bin2hex(random_bytes(16));
if(file_put_contents("peppermint.json", json_encode($settings, JSON_PRETTY_PRINT)) === false) {
http_response_code(503);
header("content-type: text/plain");
exit("Oops! It looks like $settings->sitename wasn't able to write peppermint.json to disk.\nThis file contains all of $settings->sitename's settings, so it's really important!\nHave you checked that PHP has write access to the directory that index.php is located in (and all it's contents and subdirectories)? Try\n\nsudo chown USERNAME:USERNAME -R path/to/directory\n\nand\n\nsudo chmod -R 0644 path/to/directory;\nsudo chmod -R +X path/too/directory\n\n....where USERNAME is the username that the PHP process is running under.");
}
}