Announcement

Collapse
No announcement yet.

Permission Denied - Bad Server Response

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Permission Denied - Bad Server Response

    EspoCRM was up and running beautifully. Suddenly, it returned a "Bad Server Response" error and stopped working completely for everybody. No one can even get to the login screen.

    The log report shows the following two error notices, repeating endlessly:

    [2018-07-03 04:53:45] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/routes.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/routes.php because Permission denied","file":"/opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php","line":502,"context":{"filePath":"dat a/cache/application/routes.php","defaultPermissions":{"dir":"0775","fi le":"0664","user":2,"group":2},"pathParts":{"dirna me":"data/cache/application","basename":"routes.php","extension":" php","filename":"routes"}}} []

    [2018-07-03 04:53:45] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/routes.php" at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php line 204 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/routes.php at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php:204)"} []

    [2018-07-03 04:53:46] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/routes.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/routes.php because Permission denied","file":"/opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php","line":502,"context":{"filePath":"dat a/cache/application/routes.php","defaultPermissions":{"dir":"0775","fi le":"0664","user":2,"group":2},"pathParts":{"dirna me":"data/cache/application","basename":"routes.php","extension":" php","filename":"routes"}}} []

    [2018-07-03 04:53:46] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/routes.php" at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php line 204 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/routes.php at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php:204)"} []

  • #2
    Hello,
    set the check the owner and permission for data folder.

    Comment


    • #3
      I think I have the permissions for the data folder correct. But I ran the commands on the page you linked to. Still getting the "bad server response." Below is what I get when I check the permissions for the data folder (as a subdirectory of the htdocs folder). If I'm reading it correctly, it looks like data is set to 775.

      [root@localhost htdocs]# ls -l
      total 72
      drwxr-xr-x 3 33 33 15 Feb 9 13:41 api
      drwxr-xr-x 3 33 33 17 Feb 9 13:41 application
      -rw-r--r-- 1 33 33 1462 Feb 9 11:23 bootstrap.php
      -rw-r--r-- 1 33 33 1564 Feb 9 11:23 clear_cache.php
      drwxr-xr-x 12 33 33 136 Feb 9 13:42 client
      -rw-r--r-- 1 33 33 1556 Feb 9 11:23 cron.php
      drwxrwxr-x 3 33 33 17 Feb 9 13:43 custom
      drwxrwxr-x 6 33 33 85 Mar 1 14:35 data
      -rw-r--r-- 1 33 33 2683 Feb 9 11:23 extension.php
      drwxr-xr-x 2 33 33 40 Feb 9 13:42 html
      -rw-r--r-- 1 33 33 1611 Feb 9 11:23 index.php
      drwxr-xr-x 4 33 33 26 Apr 6 00:37 install
      -rw-r--r-- 1 33 33 35146 Feb 9 11:23 LICENSE.txt
      drwxr-xr-x 2 33 33 55 Feb 9 13:42 portal
      -rw-r--r-- 1 33 33 1562 Feb 9 11:23 rebuild.php
      -rw-r--r-- 1 33 33 2954 Feb 9 11:23 upgrade.php
      drwxr-xr-x 19 33 33 4096 Feb 9 13:42 vendor
      -rw-r--r-- 1 33 33 2704 Feb 9 11:23 web.config

      Comment


      • #4
        check permissions in data/cache and data/cache/application as well

        Comment


        • #5
          I pasted what the permissions show below. Previously, the owner was daemon. If the permissions are correct, but the owner has changed, would that be causing the problem?

          [root@localhost data]# ls -l
          total 140
          drwxrwxr-x 4 33 33 39 Jul 3 03:58 cache
          -rwxrwxr-x 1 33 33 8656 Jul 3 03:56 config.php
          drwxrwxr-x 2 33 33 4096 Jul 3 03:56 logs
          drwxrwxr-x 5 33 33 81920 Jul 2 23:01 upload

          [root@localhost cache]# ls -l
          total 4
          drwxrwxr-x 2 33 33 26 Jul 3 03:58 advanced
          drwxrwxr-x 3 33 33 4096 Jul 3 03:57 application

          [root@localhost application]# ls -l
          total 2316
          drwxrwxr-x 2 33 33 90 Jul 3 03:58 acl
          -rwxrwxr-x 1 33 33 26 Jul 3 03:57 autoload.php
          -rwxrwxr-x 1 33 33 50 Jul 3 08:07 cronLastRunTime.php
          -rwxrwxr-x 1 33 33 10040 Jul 3 03:57 hooks.php
          -rwxrwxr-x 1 33 33 1400 Jul 3 03:57 jobs.php
          -rwxrwxr-x 1 33 33 748664 Jul 3 03:57 metadata.php
          -rwxrwxr-x 1 33 33 123 Jul 3 03:57 modules.php
          -rwxrwxr-x 1 33 33 931893 Jul 3 03:57 objMetadata.php
          -rwxrwxr-x 1 33 33 648457 Jul 3 03:57 ormMetadata.php
          -rwxrwxr-x 1 33 33 4556 Jul 3 03:57 services.php

          Comment


          • #6
            It could be causing the problem.
            Check default permissions in data/config.php and who runs cron.php from crontab

            Comment


            • #7
              I'm not sure what if anything this means. But when I ran the commands you suggested above, it looks like the log file stopped generating the repeating errors that it had been generating. The last two entries are below. They look the same as the previous errors. It had been generating this pair of errors about once every second (about 60 times per minute). It has now stopped generating anything new in the log. But I still get the "bad server response" message when trying to reach the login page.

              [2018-07-03 07:49:35] Espo.WARNING: E_WARNING: touch(): Unable to create file data/cache/application/routes.php because Permission denied {"code":2,"message":"touch(): Unable to create file data/cache/application/routes.php because Permission denied","file":"/opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php","line":502,"context":{"filePath":"dat a/cache/application/routes.php","defaultPermissions":{"dir":"0775","fi le":"0664","user":2,"group":2},"pathParts":{"dirna me":"data/cache/application","basename":"routes.php","extension":" php","filename":"routes"}}} []

              [2018-07-03 07:49:35] Espo.ERROR: Uncaught Exception Espo\Core\Exceptions\Error: "Permission denied for data/cache/application/routes.php" at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php line 204 {"exception":"[object] (Espo\\Core\\Exceptions\\Error(code: 500): Permission denied for data/cache/application/routes.php at /opt/bitnami/apps/espocrm/htdocs/application/Espo/Core/Utils/File/Manager.php:204)"} []

              Comment


              • #8
                I'm having a bit of trouble finding the cron.php file. But the default permissions in data/config.php show as

                'defaultPermissions' => [
                'user' => 2,
                'group' => 2
                ]

                Comment


                • #9
                  Check the owner in data/cache again and run in terminal
                  sudo -u 2 php rebuild.php

                  Comment


                  • #10
                    It tells me that "2" is an unknown user. Should I run it as "root" user?

                    Comment


                    • #11
                      set the user, which one you use for web server (deamon or what). 33 is www-data user in general.
                      If you use root, the rebuild will be correct, but you could have the problem with permission again.

                      Comment


                      • #12
                        Root got me back in. Seems to be good as new. You are awesome. Thank you so much.

                        Comment


                        • #13
                          Just a follow-up on the same issue. It happened again this evening. I was able to resolve the issue by using the same fix to the permissions.

                          But I noticed also that the problem happened both times while I was editing a formula in the entity manager.

                          I'm not sure if I was just twice unlucky, or if I have stumbled onto a bug of some sort. But thanks again for your help.

                          Comment


                          • #14
                            Check if your cron is configured under web-server user.
                            Job Offers and Requests

                            Comment

                            Working...
                            X