Work inside the PHP container
Work inside the PHP container
Use the PHP container as your project shell. It has the same mounted project files, the same service hostnames, and the toolchain expected by Devilbox workflows.
Enter PHP
From the Devilbox repository root:
./dvl.sh up php./dvl.sh shell./dvl.sh shell [php-version] opens an interactive shell as the
devilbox user. It auto-detects .devilbox.yaml from the current
project path when possible.
Examples:
./dvl.sh shell./dvl.sh shell php82./dvl.sh shell php84Run one command without entering
Use exec for short tasks:
./dvl.sh exec "php -v"./dvl.sh exec "composer --version"Dedicated wrappers are better for common project commands:
./dvl.sh composer install./dvl.sh magento cache:clean./dvl.sh magerun cache:statusWork in a project
Projects live under data/www on the host and /shared/httpd in PHP.
cd data/www/my-project../../../dvl.sh shellInside the container:
cd /shared/httpd/my-projectcomposer installnpm installnpm run buildIf you use the global installer symlink, the host command is shorter:
cd data/www/my-projectdvl shellMagento workflow
For Magento projects, prefer the DVL wrappers from the host:
./dvl.sh composer install./dvl.sh magento setup:upgrade./dvl.sh magento cache:clean./dvl.sh magento indexer:reindexInside the PHP shell, direct commands also work:
php bin/magento cache:cleanphp bin/magento setup:di:compilecomposer require vendor/packageNode workflow
Use the PHP container when your selected PHP image contains the required Node tooling:
npm installnpm run devnpm run buildFor long-running Vite, Next.js, or frontend dev servers, bind them to all interfaces so the host can reach them:
npm run dev -- --host 0.0.0.0Then open the exposed host port configured for that project or stack.
User and permissions
The shell runs as devilbox, mapped to NEW_UID and NEW_GID from
.env. Files created in the container should be editable on the host.
Check the mapping:
idtouch /shared/httpd/permission-check.txtexitls -l data/www/permission-check.txtrm data/www/permission-check.txtIf ownership is wrong, update .env:
NEW_UID=501NEW_GID=20Then recreate containers:
./dvl.sh down./dvl.sh upService hostnames
Use service names from inside PHP:
| Service | Hostname | Typical port |
|---|---|---|
| HTTPD | httpd | 80 / 443 |
| MySQL/MariaDB | mysql | 3306 |
| Redis | redis | 6379 |
| OpenSearch | opensearch | 9200 |
| DNS | bind | 53 |
Example database check:
mysql -h mysql -u root -pBecome root only when needed
The devilbox user can use passwordless sudo in the PHP image:
sudo apt updatesudo apt install -y nmapLeave the container
Exit the shell:
exitStop the stack when finished:
./dvl.sh down