Sometimes it happens, that you get a blank page or not see the result you want to see. In this situations you could start to hack the code, or use the default Debugging Features of Vtiger.
Database Debugging
50% of all problems are a result of corrupt or wrong database queries. There is a fast an easy way to recognize this and get a detailed output, where you need to search for the issue. Also this information helps support persons of module providers to get a more detailed error description.
Open the file include/database/PearDatabase.php
Search the line $adb->connect(); (At the end of the file)
You have 2 options in this situation:
- Add the line:
$adb->setDebug(true);
This line will output EVERY Query sent to the database. The last one will be the corrupt one and you get an error description, when an error happens.
Sometimes it will be helpful to get all queries and also see queries, before the exception - Add the line:
$adb->setDieOnError(true);
This line will output only a detailed error report if a query generates an database error. This works better for module support, because you don’t need to read every query, if you don’t want to.
If you find (and maybe solved) the problem, do not forget to disable this lines, because it could lead to unexpected behavior.
PHP Debugging
VtigerCRM disable the display of errors in browser, per default. This is good and prevent confusion of your employee!
If more users works in one system, you should only use the method of Log-File Debugging, because vtiger will output a lot of unnecessary errors.
Log Files
The easiest way is to take a look in your Webserver error.log. If your server is configured in a default way, or configured by Plesk, ISPConfig, cpanel, … you will found a directory “logs”, which contains a file “error.log”. This error log contains every error, warning the Vtiger generates. (And this could a lot.)
The most important lines are at the bottom of this file.
If you see somethine like
... PHP message: PHP Fatal error: ...
You found your problem and you only needs to send the line to your administrator or module support.
If you use PHP >= 5.5 you probably needs to do 1 modification in the config.inc.php, before you get this error.
To do this open config.inc.php and search for
error_reporting(E_WARNING & ~E_NOTICE & ~E_DEPRECATED)
You should find two lines ~17,18, which contains this part. Replace it with
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED)
Otherwise you don’t get Fatal errors and only see unimportant Warnings.
Display Errors
If you are alone in your vtiger or know, nobody else is working, you also could do this. It maybe is a faster to see the error, because it is output to the browser.
Open the file config.inc.php
Search the line, which starts with
//ini_set('display_errors','on'); version....
Remove the // in front of the line, which activate this line. Here the same notice, like one paragraph before: If you use PHP >= 5.5, you also needs to adjust this line.
Now you could open the blank page again and should see something like
Fatal error:….
This is the problem and if you solve it, the page should work again. If nothing is written to the page, maybe the reason is not PHP.
SMTP Debugging
If you would set your SMTP Server and get an error, which means the mail cannot be sent, the vTigerCRM don’t inform in detail about the real problem.
To get the exact error, you must go into the code.
Open the file modules/Emails/mail.php and search for
$mail_status = MailSend($mail);
If you insert the following line, before this MailSend function, you are able to get the complete SMTP Log within the response of Ajax request during the save of Mailserver configuration. (Check your Developer Tools for this)
$mail->SMTPDebug = 2;