A modern, containerized PHP application with Apache, MySQL, and phpMyAdmin. Perfect for development, testing, or learning Docker with PHP.
- 🐘 PHP 8.2 with Apache web server
- 🗄️ MySQL 8.0 database
- 🎨 phpMyAdmin for database management
- 📱 Responsive design with modern UI
- 🔧 CRUD operations for user management
- 🐳 Docker containerized for easy deployment
- 🚀 One-click setup with automated scripts
- Docker Desktop installed and running
-
Clone the repository:
git clone https://github.com/YOUR_USERNAME/php-docker-app.git cd php-docker-app -
Run the setup script:
Windows:
setup.bat
Linux/Mac:
chmod +x setup.sh ./setup.sh
-
Access the application:
- Main App: http://localhost:8080
- phpMyAdmin: http://localhost:8081
- User Management System - Add, view, and delete users
- Sample Data - Pre-loaded with example users
- Database Admin - Full phpMyAdmin interface
- Modern UI - Clean, responsive design
- No Conflicts - Uses different ports than WAMP/XAMPP
If you prefer manual setup:
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# View logs
docker-compose logs
# Restart services
docker-compose restart| Service | URL | Description |
|---|---|---|
| Main App | http://localhost:8080 | PHP application |
| phpMyAdmin | http://localhost:8081 | Database management |
| MySQL | localhost:3307 | Database server |
- Username:
phpuser - Password:
phppass - Database:
phpapp - Root Password:
rootpass
php-docker-app/
├── index.php # Main application file
├── config.php # Database configuration
├── init.sql # Database initialization
├── Dockerfile # PHP/Apache container config
├── docker-compose.yml # Multi-container setup
├── setup.bat # Windows setup script
├── setup.sh # Linux/Mac setup script
├── .gitignore # Git ignore rules
└── README.md # This file
Edit docker-compose.yml to use different ports:
ports:
- "8080:80" # Change 8080 to your preferred port
- "3307:3306" # Change 3307 to your preferred port
- "8081:80" # Change 8081 to your preferred port- Modify
index.phpfor new functionality - Update
init.sqlfor database changes - Add new PHP files as needed
Port already in use:
# Check what's using the port
netstat -an | findstr :8080
# Change ports in docker-compose.ymlDocker not running:
- Start Docker Desktop
- Wait for it to fully load (green icon)
Database connection failed:
- Wait 30 seconds for MySQL to start
- Check logs:
docker-compose logs mysql
Permission denied (Linux/Mac):
sudo chmod +x setup.sh- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
This project is open source and available under the MIT License.
Give a ⭐️ if this project helped you!
If you have any questions or issues:
- Check the troubleshooting section
- Open an issue
- Check the Docker Desktop documentation
Made with ❤️ using Docker and PHP