- Download the repositorys ZIP-file
- Create a project folder (this will contain the Webservers root
htdocsand the server root (server) . - Unzip the repo in a subfolder and rename it
server
The last step is not really needed but makes it a bit better readable. The folder structure at the end is:
projectname
├── htdocs <-- root of the webserver
├── logs <-- place for log files
└── server <-- apache, php and db server
Note
A configured xdebug.ini file sits in the server folder. It defaults to allow step debugging. After changing make sure to restart the webserver!
- Install VScode extension "Container Tools"
- Update
.envfile (Setting network and Project) - Open
compose.yamlfile and click "Run All Services"
After that the following services run with these uris>
| URI | Service |
|---|---|
| localhost:9080/ | webroot, contents of folder = ./htdocs |
| localhost:9081/ | adminer, a web based data manager |
| localhost:9306 | external db connection (only needed for external access) |
Note
from inside the network the database connection is (still) db:3306!!
In .env
- set the project and network name.
- change
MARIADB_ROOT_PASSWORDfirst time creation. After that it is fixed. So after generation of the containers you can (should) return it to its original or some other value
- Open compose.yaml and
- Click Run all services
In a termanal, start your application by running: docker compose up --build.
- Install xdebug extension
- Move the folder
.vscodeto the root of the project. This folder contains the setup for the VSCode PHP debugger (launch.json).
The copied launch.json contains settings so that the PHP Debug extension sees root of the webserver at htdocs:
"pathMappings": {
"/var/www/html": "${workspaceFolder}/htdocs"
}Move the folder htdocs including its content to the root of the project folder.
To create a database and a user open in Adminer oder a vscode MariaDB plugin
create database my_database;
create user 'my-user'@'%' identified by 'my-password';
grant all privileges on my_database.* to 'my-user'@'%';
flush privileges;