Question

Apache2 folders permissions - Ubuntu 20.04

Hi fellows: I have this Ubuntu server 20.04 with apache2. I have it configured for php5.6, php7.1, php7.2, have one site domains for every one of this php versions, and all its very good for that domains. (except for the php5.6)

I have some problem whit one php5.6 site, simply dont run. Specifically have the site fine, took the db and folders from an 18.04 server funcionally and put it on 20.04 but doenst run while the other sites go fine. In this apache2 over 20.04 i have noticed that permissions hae so meny little problems because, with one of these other sites, i had to modify some folders to www-data permissions to work fine (while in 18.4 never needed to modify folder permissions). But that aside i give yo my actual permissions structure:

/var/www myuser root (755) /var/www/html myuser root (755) /var/www/html/public_html myuser myuser (755) |__index.php myr myr 664

The other sites are with the same permissions and working.

Domain is working fine, restarted apache2, with html file “hello world” is working fine…

Right now im verificating php5.6 because noticed that only have sites working on php7.1 and php7.2, none on php5.6 (and trying with other php5.6 site and some values changed few days ago)

I hope some ideas guys, tks.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @juanfer,

You should use www-data for all your websites for both user and group. Those are the default Apache ownerships. You can check that in the following file

/etc/apache2/envvars

Anyway, on to your problem. Usually, websites can run with the root:root in such cases however most often than not they experience issues running to logs, opening other files etc. when using the root:root ownership.

What I suggest is to try and use www-data everywhere(only for the domain’s folder!) and see if the issue is still going to be experienced. If it’s still experienced checked your Apache error logs for more detailed explanation as to why it’s showing errors.

Regards, KFSys