Yii v2 snippet guide III

Comparing #51 with #52

Revision #52 was created by rackycz rackycz on Mar 8, 2021, 9:21:44 PM.

Docker

Content

[...]
Note 2: Please keep in mind that xDebug2 and xDebug3 have different settings. Details [here](https://xdebug.org/docs/).

> I spent on this approximately 8 hours. Hopefully someone will enjoy it :-) Sadly, this configuration is not present in docker-compose.yml. It would be soooo handy.

**Docker - Custom php.ini**
 
---
 
Add into section "volumes" this line:
 
 
```
 
- ./myphp.ini:/usr/local/etc/php/conf.d/custom.ini
 
```
 
 
And create file myphp.ini the root of your Yii application. You can enter for example **html_errors=on** and **html_errors=off** to test if the file is loaded. Restart docker and check results using method **phpinfo()** in a PHP file. 
 
 

**How to enter Docker's bash (cli, command line)**
---
[...]
- docker exec -it {NAME} /bin/bash
- ... where {NAME} is your service name. For example:
- docker exec -it yii-advanced_backend_1 /bin/bash

 
 
To findout what Linux is used, you can call **cat /etc/os-release**. (or check the Vagrant chapter for other commands)
 
 
If you want to locate the php.ini, type **php --ini**. Once you find it you can copy it to your yii-folder like this:
 
 
```
 
cp path/to/php.ini /app/myphp.ini
 
```