Friday, May 13, 2011

SugarCRM Troubleshooting: Formatting Woes

Does the image below look familiar?

It is the default login screen for SugarCRM Community Edition, but as one can see, the formatting is not quite right. This, unfortunately, is a common occurrence and worse yet, it usually occurs immediately following the install process.

Fortunately, the solution is rather simple. But before we get into the solution, let us spend just a couple of minutes reviewing the source of the problem so that we have a better understanding of the SugarCRM internals, which may come in handy at a later time.

Normal operation of SugarCRM requires the use of files stored in a folder named cache and located within the root SugarCRM install folder. If one were to browse said cache folder, one would find a variety of sub-folders such as modules, upload and others. The files contained in these folders are rather important to the look and feel of SugarCRM, as well as other operations.

For example, the modules folder contains templates that SugarCRM uses for the various views within the system, i.e. ListView, DetailView, EditView. In short, they are HTML templates that make the system function faster, as the page does not have to be recreated every time a user accesses one of the views.

Were we to continue examining the additional contents of the cache folder, we would also find the theme files that actually make SugarCRM look pretty. That includes graphics, JavaScript code and a style sheet, better known as CSS. 

This brings us back to the solution. The reason why the behavior portrayed in the image occurs is because the web server is unable to access the files that apply the cosmetic changes. i.e. The web server cannot properly read the cache folder. 

This is not an uncommon occurrence if one is using a Unix like operating system such as Linux, which is a rather popular platform for hosting accounts.

To correct it, we need to adjust the permissions to allow the web server proper access. This is usually accomplished by executing one (or both) of the following commands (Linux):

chmod -R 755 <sugar>/cache


chown -R <apache>.<apache_group> <sugar>/cache

Note that <apache> represents the user under which the web server is running and <apache_group> represents the user group that said user belongs to. 

Often times, specially those with hosting accounts, one will not have access to the shell to execute these commands. In such cases, one should use an FTP tool such as FileZilla to apply the proper settings, making sure to select the option to apply the changes recursively, including all subfolders and files.

IMPORTANT: Users often report that the problem persists even after applying the changes. This is usually because the changes have not been applied recursively. Attempting to apply these changes via tools such as cPanel will not yield the intended results as cPanel does not apply the changes recursively.

As a final note, it is also worth noting that the cache folder grows over time. For example, if one examines it immediately after installing SugarCRM and then again after using Dashboards or features which are heavily reliant on JavaScript (such as Studio), one would will note that there are more files within the folder. This sometimes causes similar permissions problems that cause the display issue discussed herein and require that you re-apply the settings.

So, if you notice odd visual problems, your Dashboards do not work or Studio, Email or other JavaScript rich features are malfunctioning, check out your permissions. And for those on Windows, the problem is less likely, but if you do encounter it, right click the cache folder and verify that IUSR has access to the folder and its contents (recursively).


  1. Sorry but I´m new to sugar CRM, can you explain more for hosting accounting. I have this issue and can´t find how to fix it. I´m read your comments but I don´t get how can I do it with filezilla.


  2. The exact directory will vary by hosting provider and the manner in which you installed Sugar.

    However, in general, when you connect via Filezilla you normally see a folder named 'public_html.' If you open that up (and you installed Sugar as your main site) you would then see the 'cache' folder. Right click on it and choose 'File Permissions' from the local menu.

    Set the numeric value to 755, enable 'Recurse into subdirectories' and 'Apply to all files and directories' and click OK to to apply.

    1. Angel YOU ROCK! Very precise explanation. I followed your instructions and in minutes corrected my issue. Thanks!

  3. Thanks for the valuable advice. It has helped me a lot and solved all my formatting issues with sugarcrm.
    keep up the good job

  4. Perfect Guidance for the Novice. Thanks a ton!

  5. Thanks a lot. i really appreciate your contribution.

  6. Hello,
    I'm experiencing lots of permissions troubles again and again, and with different providers. Is there less of these permissions issues on Windows ?

  7. @Nash:

    What kind of permissions problems are you referring to? Do you mean the above described issue continues to repeat itself, or ??

    My reason for asking is that it seems a bit unnecessary to go to that extent when permissions problems are usually easily corrected.

    Of course, if your hosting provider makes it a continuous challenge to maintain your system in proper working order, then yes, a switch is definitely considering, although it doesn't necessarily need to be to Windows.

  8. In my case (hosting with Dreamhost), apache server uses "group" permissions, so I have to do chmod 775 instead of 755.
    Also, very important, after install.php, I need to edit config.php and change default permissions in new directories (js caches) in line dir_mode = 1533 (instead of 1528) and file_mode = 436 (instead of 432).

  9. @soroatic:

    Thanks for sharing some words on your experience. Hopefully others will find them helpful as well.

  10. Hello,

    I am using a cPanel and having a similar issue with undefined messages. I am using version 6.3.1. Is there a solution using the cPanel, or is something different causing an issue. I am new to SugarCRM so any assistance would be greatly appreciated.

    Many thanks!

  11. @Ralph:

    You need to use an FTP client to make the changes. See the second comment (from me) on this page for instructions on how to do it via the FTP client FileZilla. You should be able to logon to your hosting account via FTP using the same credentials as those provided for you to login via cPanel. That's standard practice.

  12. Hi Angel,

    Many thanks for your response. I will execute via FTP. I am now having a slightly different issue. When I go to my SugarCRM page in my browser I am see the following warning messages:

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/modules/MySettings/TabController.php on line 76

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/modules/MySettings/TabController.php on line 76

    Warning: in_array() []: Wrong datatype for second argument in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 85

    Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 101

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 118

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 118

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 118

    Warning: Invalid argument supplied for foreach() in /home/planitc/public_html/sugar/include/GroupedTabs/GroupedTabStructure.php on line 118

    I am not exactly sure what they mean or where they surfaced from. There is one other colleague making changes within the database, is it possible he adjusted something in our cPanel? Please can you kindly assist when possible. Thank you for your insight, I appreciate it.

  13. @Ralph

    These don't look harmful, as they are all warnings, and can be suppressed by turning off the display of warnings within your PHP configuration.

    While that'll hide the messages, I don't really think of that as a "solution." It is possible that version of PHP you are using is not compatible or it might be missing an extension.

    This page has a list of officially supported software:

  14. I had tried many of the suggestions of 755 or 775 (and i am adding in the -R) yet im still getting the "undefined" when trying to compose an email.

    Any other suggestions? The user is cpanel username which is my apache user.

    The problem started when i did a -R 777 on the whole crm directory (this was a different issue) and i think i changed more then just the cache directory.

    Any recommendations for the rest of the directories? That might help me?

  15. @ch

    No, unfortunately all of the situations where I've encountered the problem have all been solved by an adjustment of the permissions. I don't know what else to suggest other than to double or triple check they were applied recursively.

  16. Thanks, i fixed that error , I Love you .

  17. Thanks for all post .
    I got same formatting error on sugarcrm ce edition Version 6.4.2 (Build 7526). I was not able to change cache directory permission using cpanel , I gone through forum and found that Using filezilla ( right click - file attribute - recurse into subdirectories ) set to 777.

    After all persmission set. I reload and sugarcrm works fine.

    Piyush Patel

  18. I get the same error in Accounts:

    Warning: Invalid argument supplied for foreach() in sugarcrm/include/utils.php on line 1602

    I tried the above changing the permissions but that did not help.
    Any other idea's?

    Thank you


    1. Per my previous reply, it is possible it is related to the version of PHP that you are using. Other than that, some hands on troubleshooting would be required.

  19. Muaaaaah!!! Thank you very much :) You were absolutely correct.. Solved my site's page formatting problem after reading ur post, instantly :) Thank you to the core... I cant believe how it happened n working so magnificently :)

  20. I thought I was working through permissions OK but then saw this error. Installing 6.4.4 on CentOS, Apache 2.2

    Warning: require_once(modules/DynamicFields/DynamicField.php): failed to open stream: Permission denied in /data/sites/mybasefolder/public/mysugarcrmdir/data/SugarBean.php on line 48 Fatal error: require_once(): Failed opening required 'modules/DynamicFields/DynamicField.php' (include_path='.:/usr/share/pear:/data/php/includes') in /data/sites/mybasefolder/public/mysugarcrmdir/data/SugarBean.php on line 48

    Any ideas?

    1. I don't know of any other reason other than permissions. My post above was pertaining to the sugarcrm/cache folder. It is possible your permissions in the sugarcrm folder aren't set properly either.

  21. Angel Magana,

    I did the same ,just selected cache and permission ,it is working fine .
    Thanks a lot Angel

    Subrata Nandi ,Kolkata

  22. Problem solved!.. Thanks!

    Javier Enriquez
    Net & Computer Systems

  23. That was definitely awesome!
    Truly great help.. thanks a lot :)

  24. Gracias Angel yo probé cambiando solo /cache/themes/Sugar5 y todo su contenido a 777 y funcionó...saludos desde Chile

    1. De nada Claudio, y gracias. Saludos desde Los Angeles.

      Le sugiero aplicarle la modificacion a la carpeta cache, no solo cache/themes porque existen otras carpetas fuera de cache/themes con archivos que tambien le pueden causar problemas.

  25. Hola, como dice Angel, debe hacerse el cambio de permisos en el directorio y en los subdirectorios y archivos dentro (osea, recursivamente). Hacerlo desde el Cpanel no funciona, yo usando el filezilla y conectandome a mi hosting realice el cambio y ahora ya veo bien la interfaz.

  26. Fantastic. Have not used FileZilla before. Took about 2 munites to work our I had to right click the folder, then chmod recursively, simple. You have opened my eyes. Thank you.

  27. Great,
    seems to work so far!
    THANKS !!

  28. Hola Angel,
    Menos mal que he conseguido llegar hasta tu blog.
    Soy bastante novato en este asunto, pero ya voy cogiendo experiencia "a base de palos". ya he instalado y desinstalado varias versiones por culpa de los permisos, con tus voy a intentar que se instale bien.

  29. Worked like a charm!!! :D THX!!!

  30. Thanks a lot, it worked for me, cheers!

  31. Hi Angel ,

    I set the permissions of files and folders via FTP , but they change after sometime automatically and the problem arises again with the module .
    Any ideas on how the permission issue can be corrected permanently.


    1. Take a look at this section in your config.php file:

      'default_permissions' =>
      array (
      'dir_mode' => 1528,
      'file_mode' => 432,
      'user' => '',
      'group' => '',

      Try changing dir_mode to 1533 and file_mode to 436.

  32. Chrome 28.0.1 recent update has resulted in similar display and js issues. (not to mention IE 10 issues). Could this help resolve those also?

    1. I am not seeing any such problems with Chrome 28. IE 10 is not compatible/supported at this time.

  33. Hi Angel,

    Great solution!!! Thank you.

    You always have great explanations.

    Best regards,

  34. Hi Angel,

    Thanks a ton !! Your solution still works like a knife in butter :) even after years when u wrote first (this is 2014).

    Great job !

  35. Thank you this worked perfectly! It is important to know you have to do this recursively to all files and folders!!!

  36. Hello. How can I reach you ? I have tried 100 times and still it doesn't work...


Your comments, feedback and suggestions are welcome, but please refrain from using offensive language and/or berating others. Thank you in advance.