# Docker PHP Error Logs

**URL:** <https://community.open-emr.org/t/docker-php-error-logs/11764>\
**Category:** Inpatient Development\
**Tags:** feature, infrastructure\
**Created:** [March 20, 2019, 7:35am UTC](https://community.open-emr.org/t/docker-php-error-logs/11764 "2019-03-20T07:35:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [March 20, 2019, 7:35am UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/1 "2019-03-20T07:35:10Z")

</div>

Recently (today) I was trying to find the PHP error log in the docker system. There is not one. So, I set out to create an error log by logging into the docker.

```
sudo docker exec -it standard_openemr_1

```

I checked the /var/log/apach2 folder for the error log. The error log that is there is a system error long with no PHP errors listed anywhere. This was disheartening because I really depend on the PHP error log to help guide if there is a technical issue it can point out.

So, I looked for the php.ini file. I found several. I edited them all to place the php\_errors.log in the /var/log/apache2 folder. It didn’t work. The log file is not being written to.

In searching the web some more, I found that the log files should not be inside the container.  
So said @mikesparr

> <https://github.com/docker-library/php/issues/212#issuecomment-338089362>

The logs should be streamed out to the OS for storage.  
I don’t know docker well enough to make the changes to the system.

Can a php error log be added to the next docker and it be ported out as recommended?

@MatthewVita

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [March 20, 2019, 10:31am UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/2 "2019-03-20T10:31:53Z")

</div>

hi @juggernautsei ,

The /var/log/apache2/error.log does contain the php errors in the openemr dockers. Ideally, this should also go into the openemr docker log. Thus, could then see it from outside the docker by doing:  
`docker logs <name-of-openemr-docker>`  
(this appears to be the docker standard regarding logging)

@dan_openemr , this would be a good thing to set up in the openemr dockers.(speaking of dockers, there are a two more unrelated things we need to do to get them ready for future 5.0.2 release in terms of upgrading users from 5.0.1 to 5.0.2).

-brady

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [March 20, 2019, 11:06am UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/3 "2019-03-20T11:06:47Z")

</div>

> [@brady.miller](#):
>
> docker logs \<name-of-openemr-docker\>

This command is very hard on the eyes. I ran it and my vision is not what it use to be. As the information just scrolled up the screen at a pace my eyes can’t catch any more. I really need a stationary view of the log file. Since I am use to looking just PHP errors. I missed those lines in between all the other stuff. I am whining because this is just not what I am use to and I am sure in time I will get over it.

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [March 20, 2019, 6:52pm UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/4 "2019-03-20T18:52:50Z")

</div>

hi @juggernautsei ,  
You could pipeline it to a nicer viewer such as less:

```auto
docker logs <name-of-openemr-docker> | less

```

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [March 20, 2019, 6:59pm UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/5 "2019-03-20T18:59:54Z")

</div>

@juggernautsei ,  
Check this out for lots of cool things you can do:

> **[Docker logs: how to use options, tail and grep to debug effectively](https://medium.com/the-code-review/to-boldly-log-debug-docker-apps-effectively-using-logs-options-tail-and-grep-53d2e655abcb)**
>
> When developing applications based on Docker, being able to find specific information in the logs and save this data to file can speed up…

---

<div class="post-metadata">

**Author:** ![adunsulag](https://community.open-emr.org/user_avatar/community.open-emr.org/adunsulag/32/12606_2.png) [@adunsulag](https://community.open-emr.org/u/adunsulag)\
**Post date:** [April 5, 2019, 3:52pm UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/6 "2019-04-05T15:52:58Z")

</div>

@juggernautsei So this may not work if you are running a number of dockers at once, but for a single OpenEMR instance you can also just log into the docker instance. Its what I’m doing with the unit tests right now.

Here’s a paste of what I wrote for the unit testing tips:

First get your docker instance id for openemr

```auto
docker ps

```

That should give you a screen like so

```auto
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9c214e0ce46c openemr/openemr:flex "./run_openemr.sh" 7 days ago Up 7 minutes 0.0.0.0:3000-3001->3000-3001/tcp, 0.0.0.0:8300->80/tcp, 0.0.0.0:9300->443/tcp openemr_openemr_1
272737bb9076 mariadb:10.2 "docker-entrypoint.s…" 9 days ago Up 7 minutes 0.0.0.0:8320->3306/tcp openemr_mysql_1
59865889c5ba phpmyadmin/phpmyadmin "/run.sh supervisord…" 9 days ago Up 7 minutes 9000/tcp, 0.0.0.0:8310->80/tcp    

```

Note the container id is the first line to the left of the openemr/openemr:flex Image column.  
Now execute the bash command against that container id.

```auto
sudo docker exec -i -t 9c214e0ce46c /bin/bash

```

Now you can monitor the log in the bash script that opened by running the tail command (everything after bash-4.4#).

```auto
bash-4.4# tail -f /var/log/apache2/error.log

```

---

<div class="post-metadata">

**Author:** ![juggernautsei](https://community.open-emr.org/user_avatar/community.open-emr.org/juggernautsei/32/10764_2.png) [@juggernautsei](https://community.open-emr.org/u/juggernautsei)\
**Post date:** [April 8, 2019, 4:00pm UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/7 "2019-04-08T16:00:34Z")

</div>

thank you for the update. I will use this.

---

<div class="post-metadata">

**Author:** ![brady.miller](https://community.open-emr.org/user_avatar/community.open-emr.org/brady.miller/32/10178_2.png) [@brady.miller](https://community.open-emr.org/u/brady.miller)\
**Post date:** [April 11, 2019, 8:33am UTC](https://community.open-emr.org/t/docker-php-error-logs/11764/8 "2019-04-11T08:33:42Z")

</div>

btw,  
Here’s a nifty command I found somewhere to see the php error log within the openemr docker without needing to go into the docker:

```auto
docker exec -i <name-of-openemr-docker> -c 'cat /var/log/apache2/error.log'

```
