Custom View Blows Up in Browser

I’m trying to implement a custom view for the Cases module, as per the method described here.

I put a new view called view.edit.php in custom/modules/Cases/views.

I have stripped down the code to the bare minimum:


<?
if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once "modules/Cases/views/view.edit.php";
class CustomCasesViewEdit extends CasesViewEdit {
    public function __construct() {
        parent::__construct();
    }
   public function display() {
        parent::display();
   }
}
?>

After a rebuild, when I try to create or edit a case, I get a popup with the title “An error has occurred” and then a bunch of garbled markup.

The file permissions on the view file are 755, owned by www-data.
There are no errors in the logs.

SuiteCRM 7.11.3
PHP 7.0.33
Debian 9

Are you also checking your PHP errors log? This is the one defined in your php.ini.

I think you will find a PHP Fatal there.

Well I guess that’s another problem. I’m not getting anything written in the php log file.

I turned on logging in my php.ini and created the file in /var/log. The apache user has permission to write to the file and the directory. I restarted apache.

Then I tried putting call to error_log in one of my view files and turning on logging via ini_set. Still nothing in the log even after rebuilding and loading the view. I’m just about out of ideas on that one.

However, my custom view looks to be valid because php -l returned no syntax errors on the file. Any idea what the fatal error could be?

OK well I fixed my logging problem, sort of. I was able to override the ini settings using the .htaccess file. Now I can write to the log. Before that, my phpinfo() in the browser displayed the defaults for everything, it was not picking up my php.ini settings, and yes I checked that it was reading from the right one, and restarted the server. Any ideas why? Does SuiteCRM override it somewhere?

Anyway, bad news is I still don’t see any errors there.

Make sure you’re editing the correct php.ini, that isn’t always obvious. If you change the php.ini of the CLI PHP, it will have no effect on the web server.

You can go in Admin / Diagnostics and select only “phpinfo” and see the effective php.ini path, and check the error log setting there also.

Having that log working is an essential piece of working on development with SuiteCRM… I really advise you get that working.

Remember to check also the other debug level settings. This is what I use:


display_errors = Off
error_log = php_errors.log
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

It is logging now. I see some warning from other modules, but no fatal errors, or anything when I load my custom view.

Try removing this from the end of the file

?>