Urgent help needed - HTTP ERROR 500 - Suddently I lost access to my EspoCrm

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geonaute
    Member
    • Dec 2021
    • 36

    Urgent help needed - HTTP ERROR 500 - Suddently I lost access to my EspoCrm

    Dear EspoCrm Family,

    I am sorry to disturb you with this question, but suddenly I lost access to my EspoCrm and I cannot find a way to make it work again.
    I have a lot of important information on it and daily work depends on it.

    PHP version 8.2.

    I collected the following from Error logs.

    Any idea what I can do to make it work again?

    Any help would be great.

    Thank you

    [28-Dec-2024 19:25:03 UTC] PHP Fatal error: Uncaught Espo\Core\Utils\File\Exceptions\FileError: Bad data stored in file 'data/cache/application/modules.php'. in /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/File/Manager.php:309
    Stack trace:
    #0 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/DataCache.php(64): Espo\Core\Utils\File\Manager->getPhpSafeContents()
    #1 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/Module.php(91): Espo\Core\Utils\DataCache->get()
    #2 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/Module.php(71): Espo\Core\Utils\Module->init()
    #3 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/Module.php(120): Espo\Core\Utils\Module->get()
    #4 [internal function]: Espo\Core\Utils\Module->Espo\Core\Utils\{closure}()
    #5 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/Module.php(119): usort()
    #6 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Binding/EspoBindingLoader.php(42): Espo\Core\Utils\Module->getOrderedList()
    #7 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Container/ContainerBuilder.php(194): Espo\Core\Binding\EspoBindingLoader->__construct()
    #8 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Application.php(62): Espo\Core\Container\ContainerBuilder->build()
    #9 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Application.php(54): Espo\Core\Application->initContainer()
    #10 /home/XXXXXXX/domains/omniamoving.com/public_html/crm/cron.php(35): Espo\Core\Application->__construct()
    #11 {main}
    thrown in /home/XXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/File/Manager.php on line 309
  • yuri
    Member
    • Mar 2014
    • 8469

    #2
    Try to delete the folder "data/cache/application" manually.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • geonaute
      Member
      • Dec 2021
      • 36

      #3
      Hi Yuri,

      Thank you for the swift reply and assistance.
      It did not work and just got new error logs.
      Any idea what could be wrong? I am just afraid to loose all the info. and configurations I have on my EspoCrm.

      Thank you so much.


      Attached Files

      Comment

      • yuri
        Member
        • Mar 2014
        • 8469

        #4
        You are not going to loose any data. Just in case you can make a database backup.

        Here's the post covering your new error: https://forum.espocrm.com/forum/inst...ils-file-chown
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        • geonaute
          Member
          • Dec 2021
          • 36

          #5
          Hi again Yuri,

          This is great and easy fix the problem is that I have no access to php.ini on my hostinger shared server :O

          Hmmm What to do now?



          How to Edit the php.ini File
          Editing the php.ini file at Hostinger

          Updated over a year ago The php.ini file is a configuration file used in PHP to control various settings and parameters. It contains directives that determine how PHP functions, handles data, manages resources, and interacts with web servers.



          Due to the hosting environment architecture of Web and Cloud hosting plans, access to the php.ini file is disabled. Alternatively, you can modify settings such as memory_limit, error_reporting, maximum file upload sizes, and more through the PHP Options section of your hPanel, or by adding directives such as php_flag on your .htacccess file.



          If you definitely need to access the php.ini file and all its settings, VPS hosting is the best option for you. Virtual Private Servers is a self-managed hosting solution, where you will have all the flexibility and control over your server configurations 🚀

          Comment

          • yuri
            Member
            • Mar 2014
            • 8469

            #6
            Try asking the hosting support. Tell them about the error "Call to undefined function Espo\Core\Utils\File\chown()".
            If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

            Comment

            • geonaute
              Member
              • Dec 2021
              • 36

              #7
              Hi again Yuri,

              see how kind and nice they are.

              I really need to transfer my services to a better hosting.
              Now I am not sure how to make it work since they will not help.
              They only give access to some configurations on php. :O

              Totally desperate in here. :s


              "Hostinger does not provide direct access to modify the php.ini file, and specific functions like chown are typically disabled for security reasons. However, you can try using the .htaccess file to adjust PHP settings or reach out to a developer for assistance in creating a custom php.ini file if your hosting plan supports it. If these options don't work, consider reviewing your code to avoid relying on disabled functions."

              Comment

              • geonaute
                Member
                • Dec 2021
                • 36

                #8
                And this precious comment from Hostinger....

                "The chown() function has likely been disabled for a while due to security policies on shared and cloud hosting plans. If your script was working before, it might be worth checking for any recent changes or updates in your code or server configuration that could have affected its functionality."

                " Unfortunately, the chown() function is disabled on Hostinger's shared and cloud hosting plans due to security restrictions. To use this function, you would need a VPS plan where you have root access and can configure PHP settings, including enabling such functions.​ "

                Comment

                • yuri
                  Member
                  • Mar 2014
                  • 8469

                  #9
                  Try checking file ownerships. If ownership and permissions are correct, chown should not be called preventing the error. Maybe you can fix file ownership via the hosting control panel.
                  If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                  Comment

                  • geonaute
                    Member
                    • Dec 2021
                    • 36

                    #10
                    Hmm,

                    Trying to find it, but it seems I have no access to it.

                    I believe I can change permissions to files, however what would be the correct permissions?
                    any documentation where I can find those permissions?

                    Do you believe a manual update of the latest versions could also fix it?
                    I just want to have this working and this Hostinger staff is killing me.

                    Thank you again for all the support Yuri! Amazing!

                    Click image for larger version

Name:	image.png
Views:	0
Size:	265.4 KB
ID:	113417


                    Click image for larger version

Name:	image.png
Views:	0
Size:	166.9 KB
ID:	113414Click image for larger version

Name:	image.png
Views:	0
Size:	186.3 KB
ID:	113415Click image for larger version

Name:	image.png
Views:	0
Size:	11.1 KB
ID:	113416

                    Comment

                    • yuri
                      Member
                      • Mar 2014
                      • 8469

                      #11


                      Manual update won't help.
                      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                      Comment

                      • geonaute
                        Member
                        • Dec 2021
                        • 36

                        #12
                        Hi Yuri,

                        Thanks again.
                        File permissions are not working.
                        any other possibilities to make this work?

                        I believe this should work, but whom is "Owner and Owner Group" where do I manage to see whom is the owner and owner group?

                        To set the owner and group-owner, execute these commands in the terminal:
                        cd <PATH-TO-ESPOCRM-DIRECTORY>
                        chown -R <OWNER>:<GROUP-OWNER> .;

                        Thanks

                        Comment

                        • yuri
                          Member
                          • Mar 2014
                          • 8469

                          #13
                          Check data/config-internal.php and data/config.php

                          Do you have the parameter 'defaultPermissions' in any of them? If yes, try to replace 'user' and 'group' with:

                          Code:
                                  'user' => null,
                                  'group' => null,
                          If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

                          Comment

                          • geonaute
                            Member
                            • Dec 2021
                            • 36

                            #14
                            Hi Yuri,

                            sorry for the late answer but was late in the night where i live.
                            No, I do not have those parameters in any of the files.
                            I am really lost on this one, so strange to happened from one day to another.


                            PHP Code:
                            'user' => null,
                            'group' => null, 
                            


                            Comment

                            • geonaute
                              Member
                              • Dec 2021
                              • 36

                              #15
                              First of all thank you Yuri and community.

                              I believe sharing is caring and just like I needed help, I will now provide some inputs on how to bypass this error when using a shared hosting service like me.

                              EspoCrm is now working in full.

                              Steps to mitigate the issue. when not having access to php.ini as per Yuri suggestion.

                              1- Go to
                              Code:
                              cd /home/XXXXXXXX/domains/omniamoving.com/public_html/crm/application/Espo/Core/Utils/File/
                              2- Make a backup of permissions.php file
                              Code:
                              cp Permission.php Permission.php.backup
                              3- Now, we need to modify the Permission.php file. You can edit it using nano or another text editor:
                              Code:
                              nano Permission.php
                              4- Modify the chgrpReal function to always return true::
                              Code:
                              protected function chgrpReal(string $path, $group): bool { // Skip chgrp operation on restricted environments return true; }
                              5- Modified the chgrp function to skip the operation:​
                              Code:
                              public function chgrp(string $path, $group = null, bool $recurse = false): bool { // Skip chgrp operation on restricted environments return true; }
                              6- Modify the chgrpRecurse function similarly:
                              Code:
                              protected function chgrpRecurse(string $path, $group): bool
                              {
                                  // Skip chgrp operation on restricted environments
                                  return true;
                              }​


                              7- Now set proper permissions for the new file::
                              Code:
                              chmod 644 Permission.php
                              8- Now clear the cache:
                              Code:
                              cd /home/XXXXX/domains/omniamoving.com/public_html/crm/ rm -rf data/cache/* mkdir -p data/cache/application chmod -R 775 data/cache

                              I hope this helps anyone with same issue as me.

                              Thanks yuri for all the support.

                              Comment

                              Working...