This repository provides interactive bash scripts to set up a complete PHP development environment on:
- Linux (Ubuntu/Debian-based distros)
- Windows Subsystem for Linux (WSL 1/2)
- ✅ Install PHP (version selectable: 8.1 - 8.4)
- ✅ Install Node.js (via LTS, specific version, or nvm)
- ✅ Install Composer, Laravel Installer, and Valet for Linux
- ✅ Web servers: Nginx, Apache, or both
- ✅ Databases: MariaDB, PostgreSQL, MongoDB
- ✅ Optional tools: Xdebug, Redis, Docker, ZSH, UFW Firewall
- ✅ GUI tools: pgAdmin, phpMyAdmin, MongoDB Compass, DBeaver, VS Code, Postman/Insomnia
- ✅ Auto configures Git & SSH for GitHub
- ✅ Adds useful command aliases
- ✅ Creates detailed log file for troubleshooting
| Script | Target Platform | Description |
|---|---|---|
setup.sh |
Linux (Ubuntu/Debian) | Full setup script for Linux |
setup-wsl.sh |
Windows WSL 1/2 | Adapted setup script for WSL + Windows notes |
git clone https://github.com/oheneadjei/php-dev-setup.git
cd php-dev-setupchmod +x setup.sh setup-wsl.sh- Linux:
./setup.sh- WSL (Windows Subsystem for Linux):
./setup-wsl.sh- GUI tools like phpMyAdmin, pgAdmin, or Compass may have limited support.
- Recommended: Install these GUI apps on Windows:
Snap is often unsupported on WSL. The script detects this and offers alternatives.
Default aliases added (can be customized during setup):
alias serve="php artisan serve"
alias art="php artisan"
alias nginx-restart="sudo systemctl restart nginx"
alias mongo-start="sudo systemctl start mongod"
start_project() {
cd ~/Projects/"$1" && valet link && php artisan serve
}📢 Run serve to quickly start a Laravel server.
MIT License - See LICENSE
Ohene Adjei
https://ohene.dev
GitHub: @oheneadj
💡 Contributions, suggestions, and PRs are welcome!
- Git:
John Doe <john@example.com> - PHP:
PHP 8.4.1 (cli) - Node.js:
v18.17.0 - Composer:
2.7.x - Web Server:
Nginx - Database:
PostgreSQL - Laravel Installer: Installed
- Docker: Installed
- Redis: Enabled
- Aliases: Added to
.bashrcor.zshrc - Log File:
~/php-dev-setup-YYYYMMDD_HHMMSS.log
Tested on:
- Ubuntu 22.04 LTS
- Debian 11
- WSL 2 (Ubuntu on Windows 10/11)
Please open an issue for bugs or environment-specific improvements.
php-dev-setup/
├── setup.sh
├── setup-wsl.sh
├── alias-sample.sh
├── LICENSE
└── README.md