Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project php_version ignored, different default php version on web container #6047

Open
1 task done
pierzakp opened this issue Apr 4, 2024 · 9 comments
Open
1 task done

Comments

@pierzakp
Copy link

pierzakp commented Apr 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Output of ddev debug test

Expand `ddev debug test` diagnostic information
�[32mRunning bash [-c /var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/test_ddev.sh /var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt]�[0m
�[32mResulting output will be written to:
/var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt
file:///var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt
Please provide the file for support in Discord or the issue queue.�[0m
�[32mDoing ddev poweroff but will restart projects at completion�[0m
�[32mStopped Mutagen daemon�[0m


======== Output file will be in /var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt ========


======== Existing project config ========
ddev installation alternate locations:
/usr/local/bin/ddev



WARNING: Project should most often be in a subdirectory of the user's home directory.
Instead it's in /Volumes/Secondary/Workspace/xyz

These config files were loaded for project xyz: [/Volumes/Secondary/Workspace/xyz/.ddev/config.yaml]
name: xyz
type: magento2
docroot: pub
php_version: 8.1
webserver_type: nginx-fpm
webimage: ddev/ddev-webserver:20240324_corepack_config
additional_hostnames: [b2b.xyz b2c.xyz]
additional_fqdns: []
database: {mariadb 10.4}
project_tld: ddev.site
use_dns_when_possible: true
timezone: UTC
composer_version: 2
nodejs_version: 16
default_container_timeout: 120


======== mutagen situation ========
looking for #ddev-generated in mutagen.yml in project /Volumes/Secondary/Workspace/xyz
MODIFIED .ddev/mutagen/mutagen.yml found


======== Creating dummy project named tryddevproject-17877 in ../tryddevproject-17877 ========
Creating a new DDEV project config in the current directory (/Volumes/Secondary/Workspace/tryddevproject-17877)
Once completed, your configuration will be written to /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/config.yaml

Configuring a 'php' project with docroot 'web' at /Volumes/Secondary/Workspace/tryddevproject-17877/web
Configuration complete. You may now run 'ddev start'.


======== OS Information ========
Darwin AMAC02FGFDCMD6M 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:11:05 PDT 2024; root:xnu-10063.101.17~1/RELEASE_X86_64 x86_64
ProductName:		macOS
ProductVersion:		14.4.1
BuildVersion:		23E224


======== User information ========
uid=501(piotr.pierzak) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),81(_appserveradm),701(com.apple.sharepoint.group.1),100(_lpoperator)


======== ddev version ========
 ITEM             VALUE
 DDEV version     v1.22.7-128-g18e53dcc4
 architecture     amd64
 db               ddev/ddev-dbserver-mariadb-10.11:20240213_mariadb_1011_default
 ddev-ssh-agent   ddev/ddev-ssh-agent:v1.22.7
 docker           24.0.7
 docker-compose   v2.26.0
 docker-platform  colima
 mutagen          0.17.2
 os               darwin
 router           ddev/ddev-traefik-router:20240213_traefik_2.11
 web              ddev/ddev-webserver:20240324_corepack_config

Instrumentation is opted in, but AmplitudeAPIKey is not available. This usually means you have a locally-built ddev binary or one from a PR build. It's not an error. Please report it if you're using an official release build.


======== proxy settings ========

 HTTP_PROXY=''
 HTTPS_PROXY=''
 http_proxy=''
 NO_PROXY=''



======== DDEV global info ========
developer-mode=false
disable-http2=false
fail-on-hook-fail=false
instrumentation-opt-in=true
instrumentation-queue-size=0
instrumentation-reporting-interval=0s
instrumentation-user=
internet-detection-timeout-ms=3000
last-started-version=v1.22.7-128-g18e53dcc4
letsencrypt-email=
mailpit-http-port=8025
mailpit-https-port=8026
mkcert-caroot=/Users/piotr.pierzak/Library/Application Support/mkcert
no-bind-mounts=false
omit-containers=[]
performance-mode=mutagen
project-tld=ddev.site
required-docker-compose-version=v2.26.0
router=traefik
router-bind-all-interfaces=false
router-http-port=8080
router-https-port=8443
simple-formatting=false
table-style=default
traefik-monitor-port=10999
use-docker-compose-from-path=false
use-hardened-images=false
use-letsencrypt=false
wsl2-no-windows-hosts-mgt=false
xdebug-ide-location=


======== DOCKER provider info ========
docker client location: /usr/local/bin/docker

docker client alternate locations:
/usr/local/bin/docker

Docker provider: colima
docker version:
Client: Docker Engine - Community
 Version:           26.0.0
 API version:       1.43 (downgraded from 1.45)
 Go version:        go1.22.1
 Git commit:        2ae903e86c
 Built:             Wed Mar 20 15:10:03 2024
 OS/Arch:           darwin/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          24.0.7
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.10
  Git commit:       311b9ff
  Built:            Thu Oct 26 09:07:58 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.25
  GitCommit:        d8f198a4ed8892c764191ef7b3b06d8a2eeb5c7f
 runc:
  Version:          1.1.10
  GitCommit:        v1.1.10-0-g18a0cb0
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

DOCKER_DEFAULT_PLATFORM=notset
colima version 0.6.8
time="2024-04-04T16:23:01+02:00" level=info msg="colima is running using QEMU"
time="2024-04-04T16:23:01+02:00" level=info msg="arch: x86_64"
time="2024-04-04T16:23:01+02:00" level=info msg="runtime: docker"
time="2024-04-04T16:23:01+02:00" level=info msg="mountType: sshfs"
time="2024-04-04T16:23:01+02:00" level=info msg="socket: unix:///Users/piotr.pierzak/.colima/default/docker.sock"
Docker platform: colima
Colima version: 0.6.8
Using Docker context: default (unix:///Users/piotr.pierzak/.colima/default/docker.sock)
docker-compose: v2.26.0
Using DOCKER_HOST=unix:///Users/piotr.pierzak/.colima/default/docker.sock
Docker version: 24.0.7
Able to run simple container that mounts a volume.
Able to use internet inside container.
Docker disk space:Filesystem                Size      Used Available Use% Mounted on
overlay                 115.2G     32.8G     82.4G  28% /


======== Existing docker containers ========
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES


======== mkcert information ========
/usr/local/bin/mkcert
/Users/piotr.pierzak/Library/Application Support/mkcert
total 16
-r--------  1 piotr.pierzak  staff  2484  6 sty  2023 rootCA-key.pem
-rw-r--r--  1 piotr.pierzak  staff  1704  6 sty  2023 rootCA.pem


======== ping attempt on ddev.site ========
PING dkdkd.ddev.site (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.050 ms

--- dkdkd.ddev.site ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.050/0.050/0.050/0.000 ms


======== Project startup ========
Network ddev_default created
Starting tryddevproject-17877...
2024-04-04T16:23:08.358 Pulled image for ddev/ddev-webserver:20240324_corepack_config
2024-04-04T16:23:08.362 Pulled image for busybox:stable
2024-04-04T16:23:08.365 Pulled image for ddev/ddev-ssh-agent:v1.22.7
2024-04-04T16:23:08.369 Pulled image for ddev/ddev-traefik-router:20240213_traefik_2.11
2024-04-04T16:23:09.16 GetDockerContext: contextInfo='default unix:///Users/piotr.pierzak/.colima/default/docker.sock'
2024-04-04T16:23:09.16 Using Docker context default (unix:///Users/piotr.pierzak/.colima/default/docker.sock)
2024-04-04T16:23:09.161 Mutagen sync session, configuration, and Docker volume are in incompatible status: 'Calculated mutagen.yml hash does not equal session label', Removing Mutagen sync session 'tryddevproject-17877' and Docker volume tryddevproject-17877_project_mutagen
2024-04-04T16:23:09.497 GetDockerContext: contextInfo='default unix:///Users/piotr.pierzak/.colima/default/docker.sock'
2024-04-04T16:23:09.497 Using Docker context default (unix:///Users/piotr.pierzak/.colima/default/docker.sock)
2024-04-04T16:23:10.912 chowning /mnt/ddev-global-cache and /var/lib/mysql to 501
2024-04-04T16:23:11.703 done chowning /mnt/ddev-global-cache and /var/lib/mysql to 501
 Container ddev-ssh-agent  Created
 Container ddev-ssh-agent  Started
ssh-agent container is running: If you want to add authentication to the ssh-agent container, run 'ddev auth ssh' to enable your keys.
2024-04-04T16:23:14.993 host.docker.internal='' because no other case was discovered
2024-04-04T16:23:15.47 Pulled image for ddev/ddev-webserver:20240324_corepack_config
20240213_mariadb_1011_default: Pulling from ddev/ddev-dbserver-mariadb-10.11
01007420e9b0: Pulling fs layer
c87549b73512: Pulling fs layer
3e877f62117e: Pulling fs layer
47e31e9a7630: Pulling fs layer
242764cd2769: Pulling fs layer
053822b225f3: Pulling fs layer
03f4cebe0a89: Pulling fs layer
0e8b8e7f51d3: Pulling fs layer
4f4fb700ef54: Pulling fs layer
f70e1b0ac3ff: Pulling fs layer
94d7d8e172c3: Pulling fs layer
383e0cde8f27: Pulling fs layer
9be7fed50eb4: Pulling fs layer
1eb6ece73150: Pulling fs layer
700560d21aa3: Pulling fs layer
65925699897e: Pulling fs layer
ebd7950a249d: Pulling fs layer
9432e9ac0d20: Pulling fs layer
b556a05fcdba: Pulling fs layer
b7ffb161a116: Pulling fs layer
9abab1f4ed96: Pulling fs layer
30727a094838: Pulling fs layer
22ec15a247bb: Pulling fs layer
05c66001c5be: Pulling fs layer
242764cd2769: Waiting
053822b225f3: Waiting
f70e1b0ac3ff: Waiting
03f4cebe0a89: Waiting
94d7d8e172c3: Waiting
0e8b8e7f51d3: Waiting
4f4fb700ef54: Waiting
383e0cde8f27: Waiting
9be7fed50eb4: Waiting
1eb6ece73150: Waiting
700560d21aa3: Waiting
65925699897e: Waiting
ebd7950a249d: Waiting
9432e9ac0d20: Waiting
b556a05fcdba: Waiting
b7ffb161a116: Waiting
47e31e9a7630: Waiting
05c66001c5be: Waiting
30727a094838: Waiting
c87549b73512: Verifying Checksum
c87549b73512: Download complete
3e877f62117e: Download complete
47e31e9a7630: Verifying Checksum
47e31e9a7630: Download complete
01007420e9b0: Verifying Checksum
01007420e9b0: Download complete
03f4cebe0a89: Verifying Checksum
03f4cebe0a89: Download complete
242764cd2769: Verifying Checksum
242764cd2769: Download complete
4f4fb700ef54: Verifying Checksum
4f4fb700ef54: Download complete
0e8b8e7f51d3: Verifying Checksum
0e8b8e7f51d3: Download complete
f70e1b0ac3ff: Verifying Checksum
f70e1b0ac3ff: Download complete
383e0cde8f27: Verifying Checksum
383e0cde8f27: Download complete
9be7fed50eb4: Verifying Checksum
9be7fed50eb4: Download complete
94d7d8e172c3: Verifying Checksum
94d7d8e172c3: Download complete
700560d21aa3: Verifying Checksum
700560d21aa3: Download complete
053822b225f3: Verifying Checksum
053822b225f3: Download complete
01007420e9b0: Pull complete
c87549b73512: Pull complete
1eb6ece73150: Verifying Checksum
1eb6ece73150: Download complete
65925699897e: Verifying Checksum
65925699897e: Download complete
ebd7950a249d: Verifying Checksum
ebd7950a249d: Download complete
9432e9ac0d20: Download complete
b556a05fcdba: Verifying Checksum
b7ffb161a116: Verifying Checksum
b7ffb161a116: Download complete
30727a094838: Verifying Checksum
30727a094838: Download complete
9abab1f4ed96: Verifying Checksum
9abab1f4ed96: Download complete
22ec15a247bb: Verifying Checksum
22ec15a247bb: Download complete
05c66001c5be: Verifying Checksum
05c66001c5be: Download complete
3e877f62117e: Pull complete
47e31e9a7630: Pull complete
242764cd2769: Pull complete
053822b225f3: Pull complete
03f4cebe0a89: Pull complete
0e8b8e7f51d3: Pull complete
4f4fb700ef54: Pull complete
f70e1b0ac3ff: Pull complete
94d7d8e172c3: Pull complete
383e0cde8f27: Pull complete
9be7fed50eb4: Pull complete
1eb6ece73150: Pull complete
700560d21aa3: Pull complete
65925699897e: Pull complete
ebd7950a249d: Pull complete
9432e9ac0d20: Pull complete
b556a05fcdba: Pull complete
b7ffb161a116: Pull complete
9abab1f4ed96: Pull complete
30727a094838: Pull complete
22ec15a247bb: Pull complete
05c66001c5be: Pull complete
Digest: sha256:b94a4a58334cef81feec30a7b54facb8aae6cb6859e4938b9b971a44703ba10d
Status: Downloaded newer image for ddev/ddev-dbserver-mariadb-10.11:20240213_mariadb_1011_default
docker.io/ddev/ddev-dbserver-mariadb-10.11:20240213_mariadb_1011_default
2024-04-04T16:23:59.027 Pulled image for ddev/ddev-dbserver-mariadb-10.11:20240213_mariadb_1011_default
2024-04-04T16:23:59.036 Pulled image for ddev/ddev-ssh-agent:v1.22.7
2024-04-04T16:23:59.044 Pulled image for ddev/ddev-traefik-router:20240213_traefik_2.11
Building project images...
2024-04-04T16:23:59.14 Executing docker-compose -f /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/.ddev-docker-compose-full.yaml build --progress=plain
......Project images built in 6s.
2024-04-04T16:24:05.148 Executing docker-compose -f /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/.ddev-docker-compose-full.yaml up -d
 Network ddev-tryddevproject-17877_default  Created
 Container ddev-tryddevproject-17877-web  Created
 Container ddev-tryddevproject-17877-db  Created
 Container ddev-tryddevproject-17877-db  Started
 Container ddev-tryddevproject-17877-web  Started
2024-04-04T16:24:07.71 Copied /Users/piotr.pierzak/Library/Application Support/mkcert:CopyIntoVolume_ymiwmfarselu into /mnt/v/mkcert in 100.414076ms
2024-04-04T16:24:07.8 Exec chown -R 501 /mnt/v/mkcert stdout=, stderr=, err=<nil>
2024-04-04T16:24:08.065 Pushed mkcert rootca certs to ddev-global-cache/mkcert
2024-04-04T16:24:08.066 VIRTUAL_HOST=tryddevproject-17877.ddev.site for web
2024-04-04T16:24:08.066 HTTP_EXPOSE=8080:80,8025:8025 for web
2024-04-04T16:24:08.066 HTTPS_EXPOSE=8443:80,8026:8025 for web
2024-04-04T16:24:09.353 Copied /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/traefik:CopyIntoVolume_msyeezdnkfrp into /mnt/v/traefik in 127.736186ms
2024-04-04T16:24:09.447 Exec chown -R 501 /mnt/v/traefik stdout=, stderr=, err=<nil>
2024-04-04T16:24:09.701 Copied Traefik certs in /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/traefik/certs to ddev-global-cache/traefik
Starting Mutagen sync process...
2024-04-04T16:24:10.505 Using Mutagen config file /Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/mutagen/mutagen.yml
2024-04-04T16:24:10.672 Creating Mutagen sync: mutagen [sync create /Volumes/Secondary/Workspace/tryddevproject-17877 docker://ddev-tryddevproject-17877-web/var/www/html --no-global-configuration --name tryddevproject-17877 --label com.ddev.volume-signature=Users-piotr-pierzak-colima-default-1712240589 --label com.ddev.config-hash=424dfd35cd346c5f809224bbc084f6ae2566848d --configuration-file=/Volumes/Secondary/Workspace/tryddevproject-17877/.ddev/mutagen/mutagen.yml]
.2024-04-04T16:24:13.976 Mutagen status after sync: ok
Mutagen sync flush completed in 4s.
For details on sync status 'ddev mutagen st tryddevproject-17877 -l'
2024-04-04T16:24:13.979 Running /start.sh in ddev-webserver
Waiting for web/db containers to become ready: [web db]
2024-04-04T16:24:27.322 Testing to see if /mnt/ddev_config is properly mounted
Starting ddev-router if necessary...
2024-04-04T16:24:35.151 Copied /Users/piotr.pierzak/.ddev/traefik:CopyIntoVolume_lulcolinehxn into /mnt/v/traefik in 190.269026ms
2024-04-04T16:24:35.3 Exec chown -R 501 /mnt/v/traefik stdout=, stderr=, err=<nil>
2024-04-04T16:24:35.649 Copied global Traefik config in /Users/piotr.pierzak/.ddev/traefik/certs to ddev-global-cache/traefik
 Container ddev-router  Created
 Container ddev-router  Started
2024-04-04T16:24:37.328 Waiting for ddev-router to become ready. docker inspect --format "{{json .State.Health }}" ddev-router
2024-04-04T16:24:43.347 ddev-router is ready
Waiting for additional project containers to become ready...
All project containers are now ready.
Successfully started tryddevproject-17877
Project can be reached at https://tryddevproject-17877.ddev.site:8443 https://127.0.0.1:60002
Instrumentation is opted in, but AmplitudeAPIKey is not available. This usually means you have a locally-built ddev binary or one from a PR build. It's not an error. Please report it if you're using an official release build.


======== Curl of site from inside container ========
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 04 Apr 2024 14:24:57 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0


======== curl -I of http://tryddevproject-17877.ddev.site:8080 from outside ========
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
Date: Thu, 04 Apr 2024 14:24:57 GMT
Server: nginx
Vary: Accept-Encoding



======== Full curl of http://tryddevproject-17877.ddev.site:8080 from outside ========
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   286    0   286    0     0  12293      0 --:--:-- --:--:-- --:--:-- 12434
Success accessing database... db via TCP/IP<br />
ddev is working.<br />
The output file for Discord or issue queue is in
<b>/var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt</b><br />
file:///var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt<br />


======== Full curl of https://tryddevproject-17877.ddev.site:8443 from outside ========
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   286    0   286    0     0   1448      0 --:--:-- --:--:-- --:--:--  1451
Success accessing database... db via TCP/IP<br />
ddev is working.<br />
The output file for Discord or issue queue is in
<b>/var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt</b><br />
file:///var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt<br />


======== Project ownership on host ========
drwxr-xr-x  4 piotr.pierzak  staff  128  4 kwi 16:22 ../tryddevproject-17877


======== Project ownership in container ========
drwxr-xr-x 4 piotr.pierzak dialout 4096 Apr  4 14:24 //var/www/html


======== In-container filesystem ========
Filesystem     Type 1K-blocks     Used Available Use% Mounted on
/dev/root      ext4 120791536 35189060  85586092  30% /var/www


======== Thanks for running the diagnostic! ========
Running ddev launch in 3 seconds
Running ddev launch
Waiting 10 seconds to run ddev stop --unlist
running ddev stop --unlist
 Container ddev-tryddevproject-17877-db  Stopped
 Container ddev-tryddevproject-17877-web  Stopped
 Container ddev-tryddevproject-17877-web  Stopped
 Container ddev-tryddevproject-17877-db  Stopped
 Container ddev-tryddevproject-17877-db  Removed
 Container ddev-tryddevproject-17877-web  Removed
 Network ddev-tryddevproject-17877_default  Removed
Project tryddevproject-17877 has been stopped.
�[32m

==== Restarting previously-running DDEV projects====�[0m
�[32mOutput file written to:
/var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt
file:///var/folders/51/t6ds5ctx6ksc0mj_q2cdc_n00000gn/T/ddev-debug-test.txt
Please provide the file for support in Discord or the issue queue.�[0m

Expected Behavior

My Magento 2 based project has set php_version to 8.1 in .ddev/config.yaml.

Recently I have updated ddev (brew), and my project failed on start, as docker image for web container has changed, previously was using tag v1.22.7, now it's using ddev/ddev-webserver:20240324_corepack_config.

It failed, as my extended Dockerfile (.ddev/web-build/Dockerfile) was installing and reconfiguring new relic agent strictly for PHP 8.1, but default version was 8.2.

I was expecting that project php_version configuration will be used, and default PHP version would be 8.1.

Actual Behavior

Default php version is 8.2.

I tried also to put ENV PHP_DEFAULT_VERSION=8.1 at the beginning of my extended Dockerfile, then indeed in container default version was PHP 8.1, but new relic extension was installed for PHP 8.2 anyway.

Steps To Reproduce

No response

Anything else?

No response

@rfay
Copy link
Member

rfay commented Apr 4, 2024

Hi @pierzakp - You get to set your PHP version to whatever you want. Set it in .ddev/config.yaml, or ddev config --php-version=8.1

In your Dockerfile, use $DDEV_PHP_VERSION instead of using an explcit PHP version.

@pierzakp
Copy link
Author

pierzakp commented Apr 4, 2024

Hi @pierzakp - You get to set your PHP version to whatever you want. Set it in .ddev/config.yaml, or ddev config --php-version=8.1

In your Dockerfile, use $DDEV_PHP_VERSION instead of using an explcit PHP version.

As I mentioned, I already have set PHP version in ddev config to 8.1,
and if I run php -v in web container indeed it shows 8.1 - what is correct.

But... I started debugging why newrelic extension is being installed for PHP 8.2, not for PHP 8.1, and it seems that at moment of extension installation PHP 8.2 is default PHP version:

#13 [web  9/16] RUN curl -L "https://download.newrelic.com/php_agent/archive/10.19.0.9/newrelic-php5-10.19.0.9-linux.tar.gz" | tar -C /tmp -zx     && sudo NR_INSTALL_USE_CP_NOT_LN=1     NR_INSTALL_SILENT=1     NR_INSTALL_KEY=xyz     NR_APP_NAME=Developer     /tmp/newrelic-php5-*/newrelic-install install     && rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*
#13 0.292   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
#13 0.293                                  Dload  Upload   Total   Spent    Left  Speed
#13 0.295 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 45 26.0M   45 11.8M    0     0  12.2M      0  0:00:02 --:--:--  0:00:02 12.2M
100 26.0M  100 26.0M    0     0  14.7M      0  0:00:01  0:00:01 --:--:-- 14.7M
#13 DONE 2.9s

#14 [web 10/16] RUN php -v && exit 1
#14 0.442 PHP 8.2.15 (cli) (built: Jan 20 2024 14:14:18) (NTS)
#14 0.442 Copyright (c) The PHP Group
#14 0.442 Zend Engine v4.2.15, Copyright (c) Zend Technologies
#14 0.442     with Zend OPcache v8.2.15, Copyright (c), by Zend Technologies
#14 ERROR: process "/bin/bash -c php -v && exit 1" did not complete successfully: exit code: 1
------
 > [web 10/16] RUN php -v && exit 1:
0.442 PHP 8.2.15 (cli) (built: Jan 20 2024 14:14:18) (NTS)
0.442 Copyright (c) The PHP Group
0.442 Zend Engine v4.2.15, Copyright (c) Zend Technologies
0.442     with Zend OPcache v8.2.15, Copyright (c), by Zend Technologies
------

@rfay
Copy link
Member

rfay commented Apr 4, 2024

Could you please show your Dockerfile?

Also, you must have your homebrew set up to get "edge" versions. If that's intentional, we appreciate you testing. But if it's unintentional, you should probably revert back to using the normal brew tap.

brew tap | egrep "drud|ddev" will show you the taps. Probably you should brew uninstall ddev and then brew untap all of them. Then you should probably brew install ddev/ddev/ddev

@pierzakp
Copy link
Author

pierzakp commented Apr 4, 2024

Could you please show your Dockerfile?

Also, you must have your homebrew set up to get "edge" versions. If that's intentional, we appreciate you testing. But if it's unintentional, you should probably revert back to using the normal brew tap.

brew tap | egrep "drud|ddev" will show you the taps. Probably you should brew uninstall ddev and then brew untap all of them. Then you should probably brew install ddev/ddev/ddev

Sure, below my Dockerfile:

ENV NEW_RELIC_AGENT_VERSION="10.19.0.9"
ENV NEW_RELIC_LICENSE_KEY="xyz"
ENV NEW_RELIC_APPNAME="Developer"

# Download and install the New Relic daemon
RUN curl -L https://download.newrelic.com/debian/newrelic.list | sudo tee /etc/apt/sources.list.d/newrelic.list \
    && wget -O- https://download.newrelic.com/548C16BF.gpg | sudo apt-key add - \
    && sudo apt-get update \
    && sudo apt-get install -y newrelic-daemon

# Download and install the New Relic PHP agent
RUN curl -L "https://download.newrelic.com/php_agent/archive/${NEW_RELIC_AGENT_VERSION}/newrelic-php5-${NEW_RELIC_AGENT_VERSION}-linux.tar.gz" | tar -C /tmp -zx \
    && sudo NR_INSTALL_USE_CP_NOT_LN=1 \
    NR_INSTALL_SILENT=1 \
    NR_INSTALL_KEY=${NEW_RELIC_LICENSE_KEY} \
    NR_APP_NAME=${NEW_RELIC_APPNAME} \
    /tmp/newrelic-php5-*/newrelic-install install \
    && rm -rf /tmp/newrelic-php5-* /tmp/nrinstall*

Regarding version of brew, my intention was to use stable releases, ddev -v shows ddev version v1.22.7-128-g18e53dcc4, brew tap | egrep "drud|ddev" shows drud/ddev.

@rfay
Copy link
Member

rfay commented Apr 4, 2024

Regarding version of brew, my intention was to use stable releases, ddev -v shows ddev version v1.22.7-128-g18e53dcc4

Yes, you want to untap the edge homebrew.

But you wouldn't be getting this version from drud/ddev (but untap that).

You have installed the HEAD version at some point, so please brew uninstall -f ddev and then brew untap drud/ddev and then brew install ddev/ddev/ddev

Your problem with newrelic appears to be the newrelic version you're using, and I don't have a way to help with that.

It looks to me like you should be doing sudo apt-get install newrelic-infra -y instead of what you're currently doing anyway... https://docs.newrelic.com/docs/infrastructure/install-infrastructure-agent/linux-installation/install-infrastructure-monitoring-agent-linux/

@pierzakp
Copy link
Author

pierzakp commented Apr 4, 2024

@rfay yeah, I am not sure how it happened, proceeding with fresh installation.

For New Relic Infrastructure agent I have separated container,
problem is about New Relic PHP agent installation (PHP extension newrelic.so), this approach is fine (https://docs.newrelic.com/docs/apm/agents/php-agent/advanced-installation/php-agent-installation-non-standard-php-advanced/), it simply installs PHP extension for default PHP version, and as I presented above with "breakpoint" in Dockerfile, during extension installation PHP 8.2 is default instead of 8.1.

 > [web 10/16] RUN php -v && exit 1:
0.442 PHP 8.2.15 (cli) (built: Jan 20 2024 14:14:18) (NTS)

@rfay
Copy link
Member

rfay commented Apr 4, 2024

Yes, the default PHP version changes to 8.2 in DDEV v1.23. No, you don't want to use the default PHP version in your dockerfile, you want to carefully install using $DDEV_PHP_VERSION instead, then it will build correctly regardless. You'll need to set that up however it needs to be set up with newrelic.

@pierzakp
Copy link
Author

pierzakp commented Apr 4, 2024

Yes, the default PHP version changes to 8.2 in DDEV v1.23. No, you don't want to use the default PHP version in your dockerfile, you want to carefully install using $DDEV_PHP_VERSION instead, then it will build correctly regardless. You'll need to set that up however it needs to be set up with newrelic.

As you can see in my Dockerfile it's no up to me to decide which PHP version to use during installation, scripts simply relies on default PHP version.

My goal was simple - I want to have PHP 8.1 for my project and want to install New Relic PHP agent for PHP 8.1 strictly.

@rfay
Copy link
Member

rfay commented Apr 4, 2024

I recommend that you use the recommended install from newrelic, which I assume would be less fragile. (Of course I have no experience with newrelic, so don't know much here). And I also assume you'll be wanting to move on from 8.1 at some point.

You should be able to add this into your Dockerfile to accomplish what you want for now:

update-alternatives --set php /usr/bin/php${DDEV_PHP_VERSION}
ln -sf /usr/sbin/php-fpm${DDEV_PHP_VERSION} /usr/sbin/php-fpm
export PHP_INI=/etc/php/${DDEV_PHP_VERSION}/fpm/php.ini

Normally that is done at startup, but you need it done before you install your stuff in the Dockerfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants