My PHP is dumb-Can't display errors

Asked by James Mwaiponya

One way to know that a program execution is reaching certain point in code is to introduce an error near the point. I have tried to do this to my local iHRIS but what I am seeing is blank page, no any error message informing of what has happenned.
I have tried to modify the error_reporting configuration directive in php.ini file (/etc/php5/apache2/php.ini ) as many people say if you google but the php is still not displayng errors. Any suggestions are welcome.Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
ihris-manage-malawi Edit question
Assignee:
Juma Lungo Edit question
Solved by:
James Mwaiponya
Solved:
Last query:
Last reply:
Revision history for this message
Sovello Hildebrand (sovellohpmgani) said :
#1

Dear James,
Where do you want this message to appear? On the webpage?
Most of the errors on the webpage are being set on the module config and directed in the PHP code
e.g.
When a person is saved you have a notice that 'This record has been saved' or if you have double entries you have an error message.
These are set up here
http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.1-dev/view/head:/modules/Person/Person.xml#L33 and for duplicate records here
http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.1-dev/view/head:/modules/Person/Person.xml#L58
and the php code that controls the displays is set here

for the unique values
http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.1-dev/view/head:/modules/Person/lib/iHRIS_Module_Person.php#L85
and for page notices
lines 91 - 92 of this file here http://bazaar.launchpad.net/~intrahealth+informatics/ihris-common/4.1-dev/view/head:/modules/Person/lib/iHRIS_PageFormPerson.php

Lines 52, 65 and 73 echo these notices to the terminal and the php5/error.log file which __i think__ is what you are trying to achieve here.

To assist you better, can you point out what specifically you are trying to achieve?

Revision history for this message
Juma Lungo (jlungo) said :
#2

Hello James

If
{
   you are using the same computer we were planning to use for iHRIS Malawi Demo, the computer was set to behave like a production server. In production server, we suppress some kind of the errors from being displayed to the users.

Now to see errors, you may use apache erro log file.

open a terminal and issue the command:

tail -f /var/log/apache2/error.log

this command will display all errors.

}
  ELSE
{
 hunt for the code that modify your error logo automatically. These are residing on your PHP application and not on the /etc/php5/apache2/php.ini

for example on your iHRIS Malawi import module (see E_USER_ERROR on line 136) of module/import/lib/I2CE_PageImport.php
we suppress errors so that we can upload and process files.

}

conclusion:
the best way to view errors in a production machine is:
1.0 Open a terminal
2.0 Maximize the terminal window to see it better
3.0 Just one command sir: tail -f /var/log/apache2/error.log
4.0 Run the system
5.0 go terminal to see the errors.

Revision history for this message
James Mwaiponya (jmwaiponya) said :
#3

Hello Dr Lungu,

The question "My PHP is dumb-Can't display errors" refers to development server on my machine not the production server.

Revision history for this message
James Mwaiponya (jmwaiponya) said :
#4

Hello Sovello,

I wanted the message to appear on the web page. I was looking for something like:
Parse error:syntax error, unexpected T_STRING
/home/mundile/Documents/iHRIS/ihris-manage-malawi/4.1/modules/import/lib/I2CE_PageImport.php on line 86
However the answer is still php.ini file. The reason why errors were not displayed after switching display_errors on in the php.ini file was that I was changing coments not the actual directives and also I didn't reatart Apache.

iHRIS handles this gracefully by giving us a user friendly interface. The error is displayed when you hit "Show Details". I think the problem is solved.

Finally I am gratefully for all answers from the team because they have given more insight on how track down errors.