The PHP configuration on Trinity (and most other web servers today) has display_errors turned OFF. Therefore, if you have PHP errors and warnings you will not see them in your web page. So how do you see all of the errors and warnings without trying to convince the system administrator to turn this feature ON and restart the web server?
The two approaches below involve inserting the PHP script segment shown at the top of your PHP file to turn on certain messaging features for that web page only. Placing it at the top as a separate script segment will make it easier to remove later when you are done with it.
Insert the following at the top of your PHP file to see the PHP messages displayed within the web page itself. Multiple messages will be run together since >'br/< tags are not generated for each message (you can View Source to see the line-separated messages).
<?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL); ?>
Insert the following at the top of your PHP file to have the messages written to a log file. Here the file is named errlog.txt and is in the directory with the php file. For this to work you must FIRST create this file and make it WRITABLE for everyone. Until you do so you will find the messages in log file.
<?php fclose(fopen('errlog.txt', 'w')); ini_set('error_log', 'errlog.txt'); ini_set('log_errors',1); error_reporting(E_ALL); ?>
Note: The first line above causes the log file to be emptied (by simply opening it for writing and closing it). By doing this all messages in it will be from the last time the web page was visited (or refreshed). Remove this line if you want the log file to grow in which case the timestamps printed with each message will be important to you.
If you have a syntax error somewhere in your PHP scripts you probably will see no messages, just a blank web page, until you fix it. The log file will not be emptied or changed from the last refresh either. Therefore, don't make too many changes to your PHP without saving the file and refreshing the web page so that you have some idea where the syntax errors will be. Here are common syntax errors to look for: