0

I’m trying to move a local Craft 3 site to a local server (hosted on 1&1).

The website itself runs fine, but for some reason I can only access the admin panel when the web/cpresources folder has permissions set to 777, which I obviously don’t want. (EDIT: It also seems to work with 755, but the folder probably shouldn't be executable by everone, right?)

All other folders where Craft needs write access are set to 744, as per the install instructions, and as long as web/cpresoures are 755, everything else seems to work fine.

Does anyone have an idea what can be the issue and a possible solution here?

Unfortunately I don’t know which user PHP runs under, but as a standard web hosting setup, I would guess it should be able to write to the file system without open access for everyone, and again everything else seems to be working like normal.

UPDATE:

It only

I managed to get the user by running this code:

$username = posix_getpwuid(posix_geteuid())['name'];
$echo $username;

The reported user is the same as my account, meaning php should run as the same user that owns the files.

  • You need to determine the user/group php runs as, because that's what needs write perms for the web/cpresources folder. More here: nystudio107.com/blog/hardening-craft-cms-permissions – andrew.welch Jul 22 '18 at 19:42
  • Yes, I realise that. Unfortunately I can't really determine what the php user runs as, or what group it's in, as I'm on a shared hosting with no access to the php installation itself. But I've had a running version of Craft 2 on the same server for at least a year, and it has been writing files without any problems (assets, updates, etc.) – KSP Jul 23 '18 at 0:06
  • 1
    phpinfo() should tell you that – andrew.welch Jul 23 '18 at 1:01
  • Hm, does phpinfo() tell you the user it runs as on the server? I can't find it anywhere there at least. – KSP Jul 23 '18 at 8:00
  • It's not in phpinfo(), but I managed to find the user via posix_geteuid() and posix_getpwuid(). But it actually reports that it's running under the same user as the owner of the files (basically my account). – KSP Jul 23 '18 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.