0

I have some problem with the installation of magento.
This is the config:

Dedicated Server,
CentOS Linux release 7.3.1611 (Core),
Apache,
Mysql,
Magento CE 2.1.6

I have a user named web and the web service user is named apache:
$ id web
uid=1000(web) gid=48(apache) groups=48(apache)
$ id apache
uid=48(apache) gid=48(apache) groups=48(apache)

I had a permission problem which I will talk about here, so I have givenchmod -R 777 for all files and directories inside my Magento dir.

Also, I have done chown -R web:apache for all files and dirs inside my Magento dir.

Now permissions are as follows:

drwxrwxrwx.  4 web apache   4096 Apr 22 00:03 app
drwxrwxrwx.  2 web apache     36 Apr 22 00:03 bin
-rwxrwxrwx.  1 web apache 435065 Mar 28 23:07 CHANGELOG.md
-rwxrwxrwx.  1 web apache   1843 Mar 28 23:05 composer.json
-rwxrwxrwx.  1 web apache 344410 Mar 28 23:07 composer.lock
-rwxrwxrwx.  1 web apache   3381 Mar 28 23:07 CONTRIBUTING.md
-rwxrwxrwx.  1 web apache    631 Mar 28 23:07 COPYING.txt
drwxrwxrwx.  5 web apache     59 Apr 22 00:03 dev
-rwxrwxrwx.  1 web apache   2864 Mar 28 23:07 Gruntfile.js.sample
-rwxrwxrwx.  1 web apache   1368 Mar 28 23:07 index.php
-rwxrwxrwx.  1 web apache    315 Mar 28 23:07 ISSUE_TEMPLATE.md
drwxrwxrwx.  4 web apache     47 Apr 22 00:03 lib
-rwxrwxrwx.  1 web apache  10376 Mar 28 23:07 LICENSE_AFL.txt
-rwxrwxrwx.  1 web apache  10364 Mar 28 23:07 LICENSE.txt
-rwxrwxrwx.  1 web apache   5071 Mar 28 23:07 nginx.conf.sample
-rwxrwxrwx.  1 web apache   1427 Mar 28 23:07 package.json.sample
-rwxrwxrwx.  1 web apache    814 Mar 28 23:07 php.ini.sample
drwxrwxrwx.  2 web apache     55 Apr 22 00:03 phpserver
drwxrwxrwx.  6 web apache   4096 Apr 22 00:03 pub
drwxrwxrwx.  7 web apache   4096 Apr 22 00:03 setup
drwxrwxrwx.  7 web apache   4096 Apr 22 00:03 update
drwxrwxrwx.  6 web apache     88 Apr 22 19:02 var
drwxrwxrwx. 29 web apache   4096 Apr 22 00:03 vendor


Still I get File Permission Check Error on installation:

File Permission Check
4 file permission not met. Hide detail

The best way to resolve this is to allow write permissions for files in the following Magento directories and subdirectories. The exact fix depends on your server, your host, and other system variables. 
For help, see our File Permission Help or call your hosting provider.

"/var/www/html/zibajooyan/app/etc" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/var" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/pub/media" - Not writable, change the permissions. Show details
"/var/www/html/zibajooyan/pub/static" - Not writable, change the permissions
0

I finally found the answer. Just leaving it here for other folks might possibly encounter this problem:
The problem is with the dots at the end of the permissions.

drwxrwxrwx.  6 web apache   4096 Apr 22 00:03 pub

It means it has SELinux context which is denying users from accessing it.

For removing it we should:

  1. Disable SELINUX in /etc/sysconfig/selinux.
  2. reboot the server.
  3. run sudo find custom_magento_dir/ -exec setfattr -x security.selinux {} \; on my custom magento dir.
0

You really shouldn't disable SELinux, the better solution would be to tell SELinux that those directories should be writeable with the following command:

chcon -R -t httpd_sys_rw_content_t /path/to/dir
  • Thanks for the help. I re-enabled SELINUX=enforcing and ran $ sudo chcon -R -t httpd_sys_rw_content_t /var/www/html/zibajooyan but nothing access is being denied again. Any idea? – Pro-Magento Apr 28 '17 at 6:56
-2
 Change the modes of the file hierarchies rooted in the files
 instead of just the files themselves.

       chmod -R 777 *

 ( I think you have missed the symbol '*')

     Let me explain this with your directories
         Trial 1
            CD /var/www/html/zibajooyan
            chmod -R 777 *
--------------------------------------------------------------------
         Trial 2 - if Trial1 does not work

            CD /var/www/html/zibajooyan/app
               chmod -R 777 * 

            CD /var/www/html/zibajooyan/pub
              chmod -R 777 * 

            CD /var/www/html/zibajooyan/media
              chmod -R 777 * 

              ls -l ( check the output for the respective folder's )
---------------------------------------------------------------------
            I hope this works. 
  • Thanks for your answer. Do you mean the parent folder (zibajooyan in the code above) should have 777 permission too? If so It has but it doesn't work yet. Otherwise please advice. – Pro-Magento Apr 22 '17 at 17:19
  • Check the edited answer please. – Aarthi Athi Apr 22 '17 at 19:53
  • Thanks for the help my friend. I have done the same thing. I think I've found the problem. Please see my edit. – Pro-Magento Apr 23 '17 at 1:05

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.