When you upload files to your webserver by FTP, those files are saved on the server with some specific access permissions. Typically, everyone will be able to "read" the files and subdirectories, that is view them through the webserver, but only you and you alone (when you log into the FTP server) will be able to "write' to these files/subdirectories and modify them.
For some specific actions, b2evolution will need to modify some of its files. b2evo will also need to write new files when you use b2evo to upload an image or generate a static .html file. The problem is: b2evo is not you. More specifically: the PHP process that runs b2evo is not you!
Thus you will most likely need to change the permissions on some files and subdirectories in order to allow b2evo to write there and perform the requested actions.
Note: on somehosts, the default permissions already allow your scripts (b2evo in this cse) to change your files on your account. So you can try b2evo without changing any file permission and come back here only if you get a file permission error.
Most webservers runs some variant of UNIX. On these systems, file permissions can be changed via chmod. If you're not familiar with UNIX file permissions and chmod, check out A quick and dirty chmod Tutorial. If your server is running Windows you probably don't need to change anything.
You can change permissions on files/folder either with an FTP client program (like Filezilla), a Unix shell or a web file manager like the one built into cPanel.
Let's assume your b2evo is installed under /blogs. Here's what you need to change:
Created by fplanque • Last edit by fplanque on April 11th, 2013
In some rare cases you may also need to manually chmod 755 all folders and files contained within them that have .php files. Otherwise you'll have problems. After I changed all the pgp files to 755 it worked like a charm.
The image upload does not give read permissions!! The result is that the image file can't be seen in the posts.
I can manually chmod the permission for the image file and all is ok then.
Where is the fix for this? I am not afraid of modifying the upload php file just need to know what and where to make the mod.
BTW I did chmod the files and folders with php files to 755 and the media folder to 777 but still the individual uploads end up set to 700.
Alan
When I try to generate a stub file for one of the blogs with permission level 2, I get a "File Cannot Be Written" Message.
What is the file that needs the chmod?
Thanks
I would guess if a file can not be written, it's more than likely the folder that the file is suppose to be written to doesn't have the right privilege level, so check what CHMOD the folders that have files written to are.
I've got a little problem: I placed my weblog in the root-directory and I can not chmod the root. Are there any workarounds?
Thanks
Nico
HI,
File cannot be written!
You should check the file permissions for [/iSERVER/Cluster/k/kumeir.com/www.kumeir/b.html]. See online manual on file permissions.
WHY? Are you tell me?
Thanks
kumeir
It would be useful to have a recommendation of the proper permission mask (775, 755, 666, etc.) that should be applied to all the files in the b2evolution "blogs/" directory tree after install. The above lists some files that need to have specific masks for specific purposes, but does not specify what we should have the rest of our blog set at so that people can't mess with it.
I have the exact problem:
The image upload does not give read permissions!! The result is that the image file can't be seen in the posts.
I can manually chmod the permission for the image file and all is ok then.
Where is the fix for this? I am not afraid of modifying the upload php file just need to know what and where to make the mod.
BTW I did chmod the files and folders with php files to 755 and the media folder to 777 but still the individual uploads end up set to 700.
Alan
Same problem regarding uploaded file permissions - I can't see any of the images I upload until I manually chmod them. Anyone fixed this yet?
I have some permission troubles converting and then saving an iMovie 3 project to iMovie Hd. Can a try to digit "chmod -R 755 Media" in Termina (Apple application) to fix it?
Thanks
Hi, I think I figured out code wise how to correct the default CHMOD of 600 to be what ever you want. You have to modify your "b2_upload.php" file.
Starting at line 144:
Change this:
=======================================================================
if (!strlen($imgalt)) {
move_uploaded_file($img1, $pathtofile) //Path to your images directory, chmod the dir to 777
or die( T_('Couldn\'t upload your file to:').' '.$pathtofile);
} else {
rename($img1, $pathtofile)
or die( T_('Couldn\'t upload your file to:').' '.$pathtofile);
}
==========================================================================
To This:
Note: I'm new to PHP, so I'm assuming this is OK. Note the 0644 is the
actual CHMOD value to be set. Hope this saves some hair :)
==========================================================================
if (!strlen($imgalt)) {
if (move_uploaded_file($img1, $pathtofile)) //Path to your images directory, chmod the dir to 777
{
// Read and write for owner, read for everybody else
// echo($pathtofile); debug purposes
chmod($pathtofile, 0644);
}
else
{
die( T_('Couldn\'t upload your file to:').' '.$pathtofile);
}
} else {
rename($img1, $pathtofile)
or die( T_('Couldn\'t upload your file to:').' '.$pathtofile);
====================================================
Regards,
Curt
Faribault Minnesota
Sorry, should of been more clear. The above code is to fix the non-viewable images after you've uploaded them in your blog. By default, the CHMOD value is "600" so they are not viewable. The code I placed above, CHMODs the image to 644 if successfully uploaded so that it can be viewed by default.
Hope this helps!
Curt
Faribault Minnesota
My problem is in regards to editing the skin/template. Under templates it says I must change the permissions to 766 in order to edit--which I did. But when I changed it, I got a message saying "permission denied." What must I do in order to be able to edit the template?
For some reason, only two of my blogs have a [Gen] link for generating a static page in the blogs list. I'm getting a "Permission denied! (blog_genstatic:any:1)" when I try going to the static page generation URL manually (click on one of the existing Gen links and change the blog to another number). The files it is using do indeed exist, and are rw to the web server (666, actually), and I cannot find any difference that would cause it to work for blogs 5 and 6, but not 1, 2, 3, or 4. I tried 777 on my blogs directory, but that didn't help.
Any ideas?

Adam, you'll have to go to the "Blogs" tabs and give yourself permissions to generate static pages. It's not a chmod issue.
Thank god!!!
I have an php upload script, that have been working on another webhotel. On a new webhotel it just could not work - and I spend numberous hours pulling my hair.
Then I found out that only owner had access on uploaded pictures - ok, that was the reason other uses could not se the pictures!!
Then more hours went, cause I could not find any info about how to set there permissions on-the-fly, when i was uploading! After pulling more hair, and almost giving up, I made one last google search and found this site and the saving statement:
chmod($upload_dir.$filename, 0644);
I am now a happy man - again :)
Thanks a lot for this information!!!
/thomas, Denmark
I am having the same problem - do you need to give the full path or not?
Running out of hair....