Errors + images not loading when deploying on remote server

Hello all,

I am trying to deploy on a server I haven’t used before (and currently only have ftp access to) and I am getting errors & images are not loading (possibly because of a permissions issue?).

Site’s home page throws an error when in debug mode: The session storage directory “/var/www/website.com/html/site/sessions” is not writable. When opening up the permissions right up to 777 of the /sessions folder the home page loaded, however without any of the images.

When trying to access the panel I get these three errors:

  • The /site/accounts folder does not exist or is not writable
  • The /content folder does not exist or is not writable
  • The /media folder does not exist or is not writable

phpInfo

  • mbstring, curl, ctype, gd enabled
  • APACHE_RUN_USER: www-data
    APACHE_RUN_GROUP: www-data
  • User/Group: www-data(33)/33

Other notes

  • The media folder is not automatically being created
  • Adding gibberish to .htacesss produces a 500 internal server error
  • I have not changed any of the standard file permissions
  • Remote server with apache 2 and php 7.3.23

From what I have been reading here on the forum, could this have something to do with the file ownership on the server?

I am not sure what is the right question to ask the server provider to help resolve this… any suggestions would be super helpful.

Yes, since you could “solve” the issue for the session folder by setting the permissions to 777, the same would happen if you do the same for the other folder. But that’s not really a solution and should never be done because it is insecure.

Instead you should change folder ownership of all these folder to the Apache user, i.e. www-data and make sure that permissions are set to 755/644.

Thanks a lot @texnixe… I accessed the server via SFTP to try and change the ownership but it seems I don’t have the ability to:
chown: changing ownership of 'sessions': Operation not permitted

Also tried with sudo however I don’t have the credentials for that either as my user is not in the sudoers file.

Would you recommend that I request hosting to change folder ownership of only these folders to www-data or all folders/files? In the case that you suggest just the folders mentioned, should the change in ownership be recursive to include all sub folders/files?

Also, is it just the “user” that should change or the “group” too?

thanks a lot

Should be user and group, and yes, recursive.

But if you don’t have the rights on that server (shared hosting?) to perform such commands, then there must be another way, something like cPanel maybe?

At least support should be able to tell you how you can achieve this. After all, its nothing out of the ordinary that the Apache user needs to write to the file system.

Even databased CMS store files in the file system.

Yes, I will write to support now.

When I asked about cPanel access the hosting provider told me “the server is under a Linux partition so it doesn’t use cPanel” :frowning:

Thanks for the info. Do you think that I should ask for the user and group for the whole directory be changed?

Yes, but I’d try to get a more general answer from them how this is supposed to be handled. If you delete the project and upload again, you don’t want to run into the same issue again.

Ah yes, good point!