We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22980
    • 84 Posts
    Currently I get a blank screen rather than actual PHP errors (syntax and beyond.) How do I set those to be seen? Is this something that should be set in my php.ini, or does MODx have a level of control? (seems like this could be noted somewhere in the manager interface..)
      • 26903
      • 1,336 Posts
      Its in your php.ini, see display_errors, display_startup_errors and error_reporting settings.
        Use MODx, or the cat gets it!
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Also in line 127 of the main index.php file
        if(!isset($_SESSION['mgrValidated']) || !$_SESSION['mgrValidated']) {
            @ini_set("display_errors","0");
        }
        
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 9207 ☆ A M B ☆
          • 2,475 Posts
          Use the following settings in your php.ini file:
          	error_reporting  =  E_ALL
          	display_errors = On


          And optionally, use these settings to log errors to a log file:
          	log_errors = On
          	error_log = "/path/to/php_error.log"
          

          For security, make sure the following value is set:
          	register_globals = Off
          

          This lets will make PHP print errors to the screen (and optionally to the logs), including line numbers. Without this type of verbose output, it is virtually impossible to tell if your scripts are having problems, let alone diagnose them. On a shared hosting environment, you will probably not have any control over the contents of the php.ini file, but you can include a line in your scripts to change the error reporting level:
          		error_reporting(E_ALL)
          

          Some setups allow you to use your own local php.ini file to override system settings found in the main php.ini file. Check with your host for details.
            • 22980
            • 84 Posts
            <?php
            error_reporting(E_ALL);
            ini_set('display_errors','1');
            echo "asdf";
            ?>​


            works. Dropping the semi colon on the echo returns a blank page -- no errors.

            Even tried setting a local php.ini (which supposedly is read), with no luck.

            *frustration* What else is there?
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Are you logged in as a manager user?
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 22980
                • 84 Posts
                yes
                  • 9207 ☆ A M B ☆
                  • 2,475 Posts
                  PHP version? Is it a shared host? Can you get access to the log files?
                    • 22980
                    • 84 Posts
                    PHP Version 5.2.9


                    Shared host (eapps)


                    I can access log files - although they have been generated in the past, but for some reason they are not in this case. O.o
                    For whatever reason, it looks like the php.ini error_log location is never being set (from looking at phpinfo), although I don’t think this would cause the entire problem as other errors have been logged..
                      • 9207 ☆ A M B ☆
                      • 2,475 Posts
                      You can see which php.ini is being read if you view the output of the phpinfo(); command. Some hosts allow for the extending of the php.ini to a local copy of it, but that’s only available on some hosts and with later versions of PHP (?). I would get in contact with your host and see what they recommend. Bluehost, for example, had a certain way of activating local log files for your particular account on a shared host. It’s not as easy as printing errors to the screen, but it’s a heck of a lot better than flying blind while debugging code.