Jump to content


Photo

installation - site/assets/*/ directories

permissions

  • Please log in to reply
3 replies to this topic

#1 bpz

bpz

    Newbie

  • Members
  • Pip
  • 9 posts
  • 0

  • LocationVilnius

Posted 07 February 2012 - 07:24 AM

Suggestion: Processwire should explicitly require the developer to create site/assets/{cache,logs,files,sessions} and set appropriate write permissions for the web server to those directories. Or raise an error when unable to write to them. Because I've had problems with session data not being saved and no error shown or logs written.

#2 ryan

ryan

    Reiska

  • Administrators
  • 7,810 posts
  • 6602

  • LocationAtlanta, GA

Posted 07 February 2012 - 01:07 PM

Or raise an error when unable to write to them.


This is what it currently does. It's all handled by the installer (/install.php on a new installation). The profileImport() function creates these directories:

/site/assets/logs/
/site/assets/cache/
/site/assets/sessions/
/site/assets/files/

When the mkdir() function fails, it reports this message in red: "Error creating directory: $dir". The error message(s) would appear on the screen after you've entered your database information and clicked submit.

I had an experience with one web host where they had some automated process that came through regularly and changed the permissions of directories, without my knowledge. Of course, such an automated process isn't exactly CMS friendly.

Another situation where permissions on those directories could be lost is if you have a site running in one location, and then copy it to another. If you haven't transferred it in a way that retains permissions, you'd have to fix the permissions on those /assets/ directories (and files in them). If you have shell access, you could do something like this: chmod -R og+rw /site/assets

Is it possible you've run into something similar, or can you think of any other factors?

#3 bpz

bpz

    Newbie

  • Members
  • Pip
  • 9 posts
  • 0

  • LocationVilnius

Posted 07 February 2012 - 01:58 PM

I see, it's partly my fault - I copied the whole website from dist to local without copying the assets directory, imported a DB dump - thus no install and its checks. And PW didn't give an error when failing to write sessions to an unexisting assets/sessions. That's where it should raise :)

#4 ryan

ryan

    Reiska

  • Administrators
  • 7,810 posts
  • 6602

  • LocationAtlanta, GA

Posted 08 February 2012 - 09:39 AM

After successful installation and first login, PW isn't going to report errors on a production site in order to ensure security. When it comes to sessions, PW is delegating session control to PHP's session functions. I believe these will report errors (when PW & PHP will let them), but won't throw fatal errors/exceptions when a session can't be written. If you ever think an error might be occurring, edit your /site/config.php and change $config->debug = true; That will ensure that error messages are displayed. But having all error messages suppressed by default ($config->debug = false) is always recommended for security on any production site. Once your assets dir is writable, you'll also be able to find error messages in /site/assets/errors.txt, regardless of the debug state. Also add your email address to the $config->adminEmail in /site/config.php so that errors are emailed to you as well.





Also tagged with one or more of these keywords: permissions

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users