Development Environment Setup
This guide will walk you through setting up a complete development environment for the DWCS course. You’ll install PHP, MySQL, Apache, and configure everything needed to run the course examples locally.Prerequisites
Before starting, ensure you have:- A computer running Windows, macOS, or Linux
- At least 4GB of free disk space
- Administrative/root access to install software
- Git installed for cloning the repository
Quick Start Options
- XAMPP (Recommended)
- Manual Installation
XAMPP is an all-in-one package that includes PHP, MySQL, and Apache. This is the recommended approach for the course.
Download XAMPP
Download XAMPP 8.2.12 or later from apachefriends.org
The course materials are tested with PHP 8.2.12. Use XAMPP 8.2.12 for full compatibility.
Install XAMPP
Run the installer and select these components:
- ✅ Apache
- ✅ MySQL
- ✅ PHP
- ✅ phpMyAdmin
- Windows:
C:/xampp-8-2-12/ - Linux:
/opt/lampp/ - macOS:
/Applications/XAMPP/
Clone the Course Repository
Once your server environment is ready, clone the course repository:Note the full path where you cloned the repository. You’ll need this for Apache virtual host configuration.
Apache Virtual Hosts Configuration
Virtual hosts allow you to use friendly URLs likehttp://dwcs.localhost/ instead of http://localhost/long/path/to/files/.
Locate Apache Configuration
Find your Apache configuration directory:
- XAMPP Windows:
C:/xampp-8-2-12/apache/conf/extra/ - XAMPP Linux:
/opt/lampp/etc/extra/ - Manual Install: Usually
/etc/apache2/sites-available/
httpd-vhosts.conf file.Configure Virtual Hosts
Edit
httpd-vhosts.conf using the template provided in the repository:httpd-vhosts.conf
Update Hosts File (Optional)
Modern browsers automatically resolve
*.localhost domains to 127.0.0.1, so this step is usually not needed.However, if you have issues or are using PHP HTTP clients (like SoapClient in TEMA-06), add this line:Windows: C:\Windows\System32\drivers\etc\hosts
Linux/macOS: /etc/hostsAlternative Configuration: For TEMA-08 Google API work, you may need to temporarily use
http://localhost instead of subdomains, as Google OAuth2 has restrictions. See the commented-out virtual host section in EJEMPLO-httpd-vhosts.conf.Database Setup
The course uses MySQL extensively, starting from TEMA-04.Create Project Database
Run the database creation script from TEMA-04:Or import via phpMyAdmin:
Terminal
- Open phpMyAdmin
- Click “Import” tab
- Choose file:
TEMA-04/SQL/proyecto.sql - Click “Go”
- Database:
proyecto - Tables:
tiendas,familias,productos,stocks - User:
gestor@localhostwith passwordsecreto
Database Schema
The main project database (proyecto) structure:
For exam practice, additional databases are provided in
MUESTRA-EXAMEN2-DWCS/UNIDAD-*/SQL/ with both schema (*-esquema.sql) and data (*-datos.sql) files.PHP Configuration
Ensure your PHP installation has the required extensions.Required PHP Extensions
Recommended PHP Settings
php.ini
VS Code Setup (Recommended)
The course includes VS Code configuration for debugging.Install VS Code
Download from code.visualstudio.com
Install PHP Extensions
Install these VS Code extensions:
- PHP Debug (xdebug.php-debug)
- PHP Intelephense (bmewburn.vscode-intelephense-client)
- PHP Extension Pack (xdebug.php-pack)
Configure Launch Settings
The repository includes a sample configuration in
EJEMPLO_vscode_launch.json. Copy it to .vscode/launch.json:.vscode/launch.json
API Keys Configuration
For TEMA-08, you’ll need API keys from various services.Register for API Keys
Sign up for free API keys from:
| Service | URL | Purpose |
|---|---|---|
| AEMET | opendata.aemet.es | Spanish weather data |
| OpenWeatherMap | openweathermap.org/api | Global weather |
| ExchangeRate-API | exchangerate-api.com | Currency rates |
| Google Cloud | console.cloud.google.com | OAuth2 |
GeoPlugin and Open-Meteo don’t require API keys.
Verify Installation
Run through this checklist to ensure everything is working:Troubleshooting
Apache won't start - Port 80 already in use
Apache won't start - Port 80 already in use
Problem: Another service (Skype, IIS, etc.) is using port 80.Solutions:
- Stop the conflicting service
- Change Apache port in
httpd.conf:Then access viahttp://localhost:8080/
MySQL won't start - Port 3306 in use
MySQL won't start - Port 3306 in use
Problem: Another MySQL instance is running.Solutions:
- Stop other MySQL services from Services (Windows) or
systemctl - Change MySQL port in XAMPP config
- Use the conflicting MySQL if it’s compatible
404 Not Found on dwcs.localhost
404 Not Found on dwcs.localhost
Possible causes:
- Virtual hosts not enabled in
httpd.conf - Wrong path in
DWCS-TRABAJOvariable - Apache not restarted after config changes
Database connection errors
Database connection errors
Common issues:
- Access denied for user:
- User
gestor@localhostdoesn’t exist - Run
TEMA-04/SQL/proyecto.sqlto create user
- User
- Unknown database ‘proyecto’:
- Database not created
- Import
proyecto.sql
- PDO driver not found:
- Enable
pdo_mysqlextension inphp.ini - Restart Apache
- Enable
Xdebug not working
Xdebug not working
Verify Xdebug:Check php.ini:VS Code:
- Ensure “Listen for Xdebug” is running (F5)
- Check port 9003 in launch.json matches php.ini
SOAP/WSDL errors (TEMA-06)
SOAP/WSDL errors (TEMA-06)
Enable SOAP extension:DNS issues with .localhost domains:
Add to hosts file:
php.ini
API calls failing (TEMA-08)
API calls failing (TEMA-08)
Check:
- Valid API keys in
claves.inc.php curlextension enabledopensslextension enabled- Internet connection active
- API rate limits not exceeded
Alternative: Using PHP Built-in Server
For quick testing without Apache:The built-in server is great for quick tests but doesn’t support
.htaccess files or some Apache-specific features. Use Apache virtual hosts for full compatibility.Next Steps
Your environment is now ready! 🎉Course Overview
Learn about the course structure and learning path
PHP Fundamentals
Begin with PHP fundamentals and form processing
Database Guide
Jump to database connectivity when ready
API Integration
Advanced: External APIs and OAuth2
Getting Help
If you encounter issues:-
Check the error logs:
- Apache:
xampp/apache/logs/error.log - PHP: Check
error_loglocation withphp --ini - MySQL:
xampp/mysql/data/*.err
- Apache:
-
Test incrementally:
- Verify each component separately
- Test with simple PHP files before complex examples
- Use
phpinfo()to check configuration
-
Review course materials:
- Example configuration files in repository root
- Working examples in each TEMA
- Exam samples for reference implementations