• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Same server, different domains, different Wordpress behavior

Hello, so I've recently setup this CentOS server for hosting most of my customers' websites.

Two of these sites use Wordpress and something really strange is happening: permissions work differently on the two sites.

On one site, the wp-content folder has permissions set to 755 and everything works fine, for instance media files upload just fine through the WP interface.

On the other site, if I set wp-content permissions to 755 I can't upload media. I have to set them to 775.

So, what else can I check to sort this out? All other files and folders on the two domains have exactly the same permissions, so I guess there's something else I should check out.

Thanks for your help.
0
Daniele Brunengo
Asked:
Daniele Brunengo
  • 7
  • 6
2 Solutions
 
Jan SpringerCommented:
What account is owner of the directory/subdirectories?  Is this a different owner than the account doing the uploading?
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
The owner is root, in both websites.
0
 
Jan SpringerCommented:
Can you post the errors from the httpd access and error log?
0
How do you know if your security is working?

Protecting your business doesn’t have to mean sifting through endless alerts and notifications. With WatchGuard Total Security Suite, you can feel confident that your business is secure, meaning you can get back to the things that have been sitting on your to-do list.

 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Here are some errors:

error.log
[Sun Apr 12 02:08:24 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:24 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:34 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:34 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:42 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:42 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29, referer: http://www.ilpassaparolaloano.it/wp-admin/upload.php
[Sun Apr 12 02:08:51 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:08:51 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:08:57 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:08:57 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:08:58 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:08:58 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:09:03 2015] [error] [client 79.6.192.143] PHP Warning:  require_once(/var/www/html/ilpassaparolaloano/wp-config.php): failed to open stream: Permission denied in /var/www/html/ilpassaparolaloano/wp-load.php on line 29
[Sun Apr 12 02:09:03 2015] [error] [client 79.6.192.143] PHP Fatal error:  require_once(): Failed opening required '/var/www/html/ilpassaparolaloano/wp-config.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/ilpassaparolaloano/wp-load.php on line 29

Open in new window

0
 
Jan SpringerCommented:
there is no upload information in these logs.  are you using sftp or ftp?
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
When uploading media there's no request for sftp or ftp, only when installing plugins. Ftp is disabled on the server, I use ssh for installing plugins. But when I upload media on the first server there's no error. When I upload them on the second server I always get errors unless I give 775 permissions.
0
 
Jan SpringerCommented:
do you know how the upload is done?  there should be some log that contains the error identifying the problem.
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
I think I've nailed it. I think I've found the correct settings:
Owner: root
Group: apache

If I set it like this I can then use 755 on the uploads folder and it works. I can also set more restrictive permissions on other files and folders, and it still seems to work. I'll test it out on my other WP sites and report back. If it's consistent I may write a tutorial about this, since what you find online about this matter is often contradictory or confusing.
0
 
Jan SpringerCommented:
755 means:

7 owner can read, write, execute
5 group can read, execute
5 world can read, execute

So if you've changed the group, then you have two data points:  the permission structure was not identical and apache does not have write permission even if it's set to be the group owner.
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Ok. I don't understand why it works with 755 now then. Before setting the group to Apache, it would only work with 775.
0
 
Jan SpringerCommented:
Yes, it is illogical that changing the group fixed the problem unless it corrected a subdirectory that only had 750 and needed that group changed.
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
Setting the Group and User to Apache seems to be the solution. I have no more folders with permission higher than 755 now.
0
 
Daniele BrunengoIT Consultant, Web DesignerAuthor Commented:
The expert helped me and I came up with a solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now