Situation
Our clinic has upgraded from OpenEMR 5.0.1(7) to 5.0.2. Occasionally, a particular tab (?frame) cannot be displayed and give a message with a path and a message suggesting that perhaps the web server is temporarily down or the page has moved.
Here is the kind of message we see:
[ ] The webpage at https://âŚ/interface/main/calendar/index.php?=module=PostCalendar&func-view&tplview=&viewtype=day&Date=20190820&pc_username=&pc_category=&pc_topic=
might be temporarily down or it may have moved permanently to a new web address.
OpenEMR Version
Iâm using OpenEMR version 5.0.2 AWS Standard using a Windows 10 Chrome or Edge browser (more frequent errors than in other environments, especially with several tabs open) or macOS Mojave laptop with Chrome or FF (less commonly seen on the Mac).
Browser:
Iâm using: mostly Chrome and FF latest versions on Windows 10 or macOS Mojave.
Operating System
Iâm using: AWS Standard
Logs
Someone remind me where to look for the logs (path) ;-).
The issue is not limited to the calendar. I have seen it happen on a tab that was holding a patientâs encounter (with the various Encounter, Vitals, SOAP, etc. templates) becoming inaccessible. When this happens, other functionality seems to work fine (can open other charts, view various reports) but whatever was contained in the âbrokenâ page cannot be accessed in that Web Client session. The âfixâ is usually to use a different computer, restart the browser, or something very âaggressive.â Simply closing the web client tab and opening a New OpenEMR session usually does not correct the problem.
I was holding off on reporting this because I wanted to figure out how to reproduce the problem. I have tried for a couple of weeks and cannot come up with a way to reliably reproduce this issue. One factor seems to be having multiple tabs (other web pages, etc.) open. Opening other OpenEMR session tabs is not required to see this problem as far as I can tell.
It happens often enough to one user (who seems to have a lot of other web sessions for billing services, etc. open) to make that user think that 5.0.2 is far less reliable and usable than 5.0.1(7) was and needs other users to âlook upâ information on different computers because it isnât possible for that user to retrieve certain information from OpenEMR. Most users seem to be OK because they tend to have fewer browser tabs open on their computers.
I spoke with another EMR user (a computer savvy person) in our clinic. He was able to reproduce the issue several times last week and this morning just by using the flowboard and calendar. However, by logging out, logging back in (perhaps doing something to refresh the cache?). He was able to reproduce the issue. Iâm going to try clearing the browser cache on the computers where this happens and see if that clears the problem when this occurs.
âRalf
hi @Ralf_Lukner ,
What is the name of your openemr docker (can see with command: docker ps -a )? Then I can give you a cool command to display the log from outside the docker.
ubuntu@ip-10-0-1-145:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f721b8799187 openemr/openemr:5.0.2 â./run_openemr.shâ 10 days ago Up 37 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp standard_openemr_1
3344de9fe048 hello-world â/helloâ 6 weeks ago Exited (0) 6 weeks ago nostalgic_neumann
The log is huge. I shut down the instance and database at night so there are all kinds of errors associated with that. I perused the log and found something that might be a clue:
[Mon Aug 12 15:38:30.735946 2019] [php7:warn] [pid 1150] [client 67.61.155.243:56072] PHP Warning: A non-numeric value encountered in /var/www/localhost/htdocs/openemr/library/patient.inc on line 1919, referer: https://mydomain.com/interface/main/tabs/main.php
Ralf, my client used to get same ânon-numeric valueâ errors re: [OpenEMR]/library/patient.inc file after 5.0.2 and PHP 7.2 upgrades /Linux/.
Here is how I did bypass it (a temp solution):
Edit [OpenEMR]/library/patient.inc file (make a file backup beforehand)
Find two lines with the following calcs causing these errors:
a. $yearDiff = $nowYear - $dobYear;
b. $ageInMonths = (($nowYear * 12) + $nowMonth) - (($dobYear*12) + $dobMonth);
Replace with the following code:
// A non-numeric value encountered error temp fix
if (is_numeric($dobYear))
{
$yearDiff = $nowYear - $dobYear;
}
else
{
//echo âNot Numericâ;
}
// A non-numeric value encountered error temp fix
if (is_numeric($dobYear))
{
$ageInMonths = (($nowYear * 12) + $nowMonth) - (($dobYear*12) + $dobMonth);
}
else
{
//echo âNot Numericâ;
}
That should do it for you for now. I had checked clientâs database and it did contain valid patientsâ DOB data so this seems to me most likely it has to do with a newer PHP 7.1+ version being more sensitive to these type of calc data (not specifically to latest OpenEMR 5.0.2 ver) â so yes, weâre looking forward for a perm solution for this. Cheers.
To add on⌠yes, you could do it all in one IF statement bloc but I always treat each calc separately for a troubleshooting purpose, even if they are two in one line after each other. Cheers.
That php warning is likely not why your error is happening. Albeit we definitely want to fix php warnings; are you able to push your fix as a Pull Request to github?(if not, I can do this)
We can try to be more specific on the log where we just look for certain element; in this case maybe interface/main/calendar/index.php. So, could try:
docker exec -i standard_openemr_1 sh -c 'grep -A 5 -B 5 "interface/main/calendar/index.php" /var/log/apache2/error.log'
(this will return place in log with interface/main/calendar/index.php in addition to 5 lines above and below each âhitâ)
I agree. This is not likely the issue of the original problem.
I will try to push the change in there to openemr on GitHub. I would like to learn how (I have never done this before but I have some idea of what version control is). I have the GitHub desktop program and PHPStorm on my Mac. I could set up a development system on an EC2 instance if I need to. Which branch am I supposed to push the change to? Also, are there any suggestions/guides on things I should or should not do with regard to the pushâing the Pull Request?
@brady.miller
One of my staff just saw this issue and the error.log did not change so I do not know why this is happening. This staff member was able to reproduce the issue on two different Windows 10 PCs with the latest version of Chrome. I have debugging on, so if there was a code-level error, it would present that.
Update: Found this in the error log:
[Sun Aug 25 22:23:23.622504 2019] [php7:error] [pid 28] [client 185.53.88.54:33732] script â/var/www/localhost/htdocs/openemr/about.phpâ not found or unable to stat
[Sun Aug 25 22:25:24.836205 2019] [allowmethods:error] [pid 22] [client 149.202.10.237:21611] AH01623: client method denied by server configuration: âCONNECTâ to /var/www/localhost/htdocs/openemr/
[Sun Aug 25 22:28:12.444638 2019] [php7:error] [pid 30] [client 185.53.88.54:44664] script â/var/www/localhost/htdocs/openemr/about.phpâ not found or unable to stat
[Mon Aug 26 11:26:53.687038 2019] [allowmethods:error] [pid 239] [client 124.88.113.154:2009] AH01623: client method denied by server configuration: âCONNECTâ to /var/www/localhost/htdocs/openemr/
[Mon Aug 26 11:26:56.289208 2019] [allowmethods:error] [pid 265] [client 112.66.99.200:18213] AH01623: client method denied by server configuration: âCONNECTâ to /var/www/localhost/htdocs/openemr/
[Mon Aug 26 11:27:02.527585 2019] [allowmethods:error] [pid 319] [client 111.224.234.70:54478] AH01623: client method denied by server configuration: âCONNECTâ to /var/www/localhost/htdocs/openemr/
âRalf
I found this error is filling the logs now also. It is rooted in the Calendar I believe. The Calendar is looking for things to display in âinterface/main/calendar/modules/PostCalendar/pnuserapi.phpâ. As it builds its array, it looks to the function getPatientAge for each member in the array, including NON patient things like out of office etc.
$tmp[âpatient_dobâ] is empty if there is no patient in the eventâŚ
if the Calendar is the only place causing this problem, maybe the fix should be there?
Alternatively, if there are other places raising this error, the fix can be here ( patient.inc) as Ralf points out.
I added this as the first line of the function and it works also:
if (empty($dobYMD)) return false;
Iâll let @brady.miller figure out which is best. If you want an official PR I can do that also.