If you have any PHP application like OnsiteSupport, you can use below instructions on how to debug the application when you create a custom addon, develop any module or just try to catch a bug.
This guide is basic and is recommended if you have any experience in development or basic experience in server administration.
Application Error Logs
In most PHP applications there are internal error logs that you can switch on in configuration file. OnsiteSupport configuration file is located at configs/config.php.
In order to switch on log displayed on the screen in case any exceptions or fatal errors, please change "show_errors" to "true".
PHP Errors
This is one of the primary things you need to check when your application doesn't work or if you experience any issues with debugging.
Depending on the web server that you use, error logs could be located in different places. For most popular apache web server in case, that PHP works as an apache module, error logs could be found at the following path on the server:
/var/log/apache2/error.log
There are some other valuable information mentioned in the following article.
Client-Side Errors
Any application including OnsiteSupport can have client-side errors. By client-side errors, we understand js errors on any page. In order to capture any js error when something is not clickable on the page and cache on the page is cleaned, open the browser console (F12 hotkey or inspect element - Console Tab) and refresh the page. As a result, you would see all js errors.
For self-hosted installations of OnsiteSupport, we recommend switch off minification of assets in configs/config.php
On the client side, you can also catch server errors in ajax requests if you switch on "show_errors" to "true" in configs/config.php and open browser console, go to the Network tab, refresh the page, click ajax request and then go to the Response tab.
OnsiteSupport Extra Debugging
When you want to find out any data or values from the script, instead of var_dump in the code, please use the following function:
fileLog($variable);
The result of the function in OnsiteSupport would be written in work/log.txt where OnsiteSupport is installed on the server.