See changes after modifying a php file?

If you modify a php file in SuiteCRM, how do you see the changes reflected in the application? Do you have to reload/reboot/re-read anything?

Thanks,

Ryan

If it’s a regular php file with code in it, normally you don’t have to do anything, just reload the page and it’s changed. There could be caching issues on the server side causing you to not see the change immediately, but my experience (on Linux, with Apache) is that it recognizes the change immediately.

But some php files are special in SuiteCRM. The ones like vardefs, layoutdefs, etc. For these files you often need to go into Admin, “Repair” menu and run a repair called “Quick repair and rebuild” to force the files to be read and processed. This is because SuiteCRM doesn’t directly use these files on normal operation; it just uses them to create another set of php files (that compile elements from several sources of SuiteCRM customizations), and this second set is what gets served to your browser.

If you’re having problems with caching you might want to try a System setting called “Developer mode”. But it slows down the application, don’t use it in production systems. This is more useful for stuff like changing themes and visual details.

1 Like

Thank you. I actually modified a file called: modules/Contacts/language/en_us.lang.php

In your opinion, does this require a repair? The file is not directly called, so probably yes?

Yes, that definitely requires a “Repair and rebuild”.

But you have to learn one important thing about customizing SuiteCRM: you should not change anything except what is in the “custom” directory, otherwise your changes will not be upgrade-safe, meaning they might disappear when you install an upgrade.

When you need to customize something, like that language file, you copy the file over to the custom directory, and change the copy there. Then “Repair and rebuild”. You should create any directories needed under the custom directory.

For example, if you want to customize
modules/Contacts/language/en_us.lang.php

then create the directories and copy the file over to
custom/modules/Contacts/language/en_us.lang.php

and change only this second file. During the Rebuild, SuiteCRM will see it is there and use it to override the settings from the original file.

1 Like

Thank you so much for this very important information. One question: If modules/Contacts/language/ has multiple php files in it, but I only want to modify one of them, then when I copy create custom/modules/Contacts/language/, do I copy all the files from the original folder over or do I just place the file that I modified in that folder? i.e. en_us.lang.php. Basically, I want to know if it’s “all or nothing” when it comes to having a custom folder that mimics the original folder structure.

Thanks,

Ryan

No, you should use a minimalist approach, copy only what you want to customize.

A final recommendation: if you want to learn all this consistently, consider buying Jim Mackin’s eBook “SuiteCRM for Developers”, it’s by far the best resource out there.

1 Like

Thank you. I’ve already bought it. I guess I should try reading it. :slight_smile: The problem is I’m trying to accomplish a goal and am doing any development as needed instead of a systematic reading of the book. Thanks again.