Hi,
I am on Windows, using Ubuntu on WSL with Laravel Sail and so far everything works.
When I build the containers (./vendor/bin/sail up -d --build) , I use ./docker/8.2 to install everything related to php 8.2 (for testing purposes, I should use 8.3).
My laravel.test container which contains php 8.2 is here as expected :
!!!!!!!!!!
Inside the container in CLI : php -v
PHP 8.2.20 (cli) (built: Jun 8 2024 21:37:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies
with Zend OPcache v8.2.20, Copyright (c), by Zend Technologies
with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
!!!!!!!!!!!
I open the browser locally on 127.0.0.1 and I go on php.php (containing phpinfo()) which is located on /public/php.php and it says I am using php 8.3.8 which is my Ubuntu version of php.
So Laravel (apache) is using the local version of php and not the php installed in the container. Any idea why?
I am correctly connecting to the mysql container
!!!!!!!!!!!
services:
laravel.test:
build:
context: ./docker/8.2
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.3/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
- '${VITE_PORT:-5173}:${VITE_PORT:-5173}'
- '443:443'
- '443:443/udp'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
IGNITION_LOCAL_SITES_PATH: '${PWD}'
SUPERVISOR_PHP_COMMAND: '/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan octane:start --server=frankenphp --host=0.0.0.0 --admin-port=2019 --port=80'
XDG_CONFIG_HOME: /var/www/html/config
XDG_DATA_HOME: /var/www/html/data
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
.........
!!!!!!!!!!!
.env :
APP_NAME=testingtesting
APP_ENV=production
APP_KEY=base64:NMEarhDtPEEzniBluVHURiHakSuXMESgcSyMtxj+14Y=
APP_DEBUG=true
APP_URL=localhost
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=testingtesting
DB_USERNAME=sail
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=none
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=127.0.0.1
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1
VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
DOCKER
FORWARD_DB_PORT=
DATA_PATH_HOST=~/.sail/data
DOCKER_HOST_IP=172.17.0.1
Point to the path of your applications code on your host
APP_CODE_PATH_HOST=./
Point to where the APP_CODE_PATH_HOST should be in the container
APP_CODE_PATH_CONTAINER=/var/www/laravel/current
You may add flags to the path :cached, :delegated. When using Docker Sync add :nocopy
APP_CODE_CONTAINER_FLAG=:cached