- XAMPP (or WAMP/MAMP) - Apache + MySQL + PHP 7.4+
- Node.js - v18+ and npm
- Git (optional)
sinath-travels/
├── client/ # React Frontend
│ ├── src/
│ │ ├── pages/
│ │ ├── components/
│ │ ├── lib/
│ │ │ ├── api.ts # NEW: API client
│ │ │ ├── data.ts # UPDATED: Now imports from API
│ │ │ └── i18n.tsx
│ │ └── main.tsx
│ └── public/
├── server/ # NEW: PHP Backend
│ ├── config/
│ │ └── database.php
│ ├── api/
│ │ ├── packages.php
│ │ ├── inquiries.php
│ │ └── services.php
│ ├── uploads/ # Image storage
│ └── .htaccess
├── database.sql # NEW: MySQL schema
├── .env.example
└── README.md
- Open XAMPP Control Panel
- Start Apache and MySQL services
- Open phpMyAdmin: http://localhost/phpmyadmin
- Click "Import" tab
- Choose
database.sqlfile - Click "Go"
Or run these commands in SQL console:
CREATE DATABASE sinath_travels CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE sinath_travels;
-- Then paste the contents of database.sqlCheck that these tables exist:
packagesinquiriespromotionsservices
Copy the server/ folder to your XAMPP htdocs:
C:\xampp\htdocs\sinath-travels\server\
Edit server/config/database.php:
private $host = "localhost";
private $db_name = "sinath_travels";
private $username = "root"; // Your MySQL username
private $password = ""; // Your MySQL password (usually empty for local)mkdir server/uploads
chmod 755 server/uploads # On Linux/MacOr create manually and ensure Apache has write permissions.
Visit these URLs in your browser:
Test Packages API:
http://localhost/sinath-travels/server/api/packages.php
Test Services API:
http://localhost/sinath-travels/server/api/services.php
You should see JSON responses with data.
cd client
npm installCreate .env file in project root:
VITE_API_URL=http://localhost/sinath-travels/server/apinpm run dev:clientThe app will open at: http://localhost:5000
- Visit http://localhost:5000
- Packages should load from MySQL database
- Services should display from database
- Go to Contact page
- Fill out the form
- Submit
- Check phpMyAdmin →
inquiriestable for new entry
curl -X POST http://localhost/sinath-travels/server/api/packages.php \
-F "title_en=Test Package" \
-F "description_en=Test Description" \
-F "price=500" \
-F "image=@/path/to/image.jpg"cd client
npm run buildThis creates dist/ folder with optimized files.
- Copy
dist/contents to your web server's public directory - Copy
server/folder to your web server - Update
.envwith production API URL - Configure Apache VirtualHost (see below)
Place this in your root directory:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# API requests go to PHP backend
RewriteCond %{REQUEST_URI} ^/server/
RewriteRule ^ - [L]
# Frontend SPA routing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule><VirtualHost *:80>
ServerName sinathtravels.com
DocumentRoot /var/www/sinath-travels/dist
<Directory /var/www/sinath-travels/dist>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Alias /server /var/www/sinath-travels/server
<Directory /var/www/sinath-travels/server>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>Symptom: Frontend can't connect to backend
Solution:
- Ensure
enableCORS()is called in all PHP files - Check Apache
mod_headersis enabled - Verify
.htaccessCORS headers
Symptom: API endpoints return 404
Solution:
- Check Apache
mod_rewriteis enabled - Verify file paths in
.htaccess - Ensure PHP files have correct permissions
Symptom: PHP errors about database connection
Solution:
- Verify MySQL is running
- Check credentials in
database.php - Ensure database exists
- Check MySQL user permissions
Symptom: Package images show broken
Solution:
- Check
uploads/directory exists and is writable - Verify image paths in database
- Check Apache permissions on uploads directory
Symptom: Contact form doesn't submit
Solution:
- Check browser console for errors
- Verify API URL in
.env - Check PHP error logs:
/xampp/apache/logs/error.log
# Backend
chmod 755 server/api/*.php
chmod 755 server/config/*.php
chmod 777 server/uploads/
# Frontend build
chmod 755 dist/| Method | Endpoint | Description |
|---|---|---|
| GET | /packages.php |
Fetch all packages |
| GET | /packages.php?category=tour |
Filter by category |
| POST | /inquiries.php |
Submit contact form |
| GET | /services.php |
Fetch services |
-
Backend Changes:
- Edit PHP files in
server/ - Test via browser or Postman
- Check PHP error logs
- Edit PHP files in
-
Frontend Changes:
- Edit React files in
client/src/ - Changes hot-reload automatically
- Check browser console
- Edit React files in
-
Database Changes:
- Edit tables in phpMyAdmin
- Update
database.sqlfor version control
- Add authentication for admin panel
- Implement email notifications (uncomment in
inquiries.php) - Add image optimization for uploads
- Set up automated backups for MySQL
- Configure SSL certificate for production
For issues, check:
- Browser console (F12)
- Apache error logs:
xampp/apache/logs/error.log - PHP error logs:
xampp/php/logs/php_error_log
Frontend:
- React 19
- TypeScript
- Tailwind CSS v4
- shadcn/ui
- React Query
- Wouter (routing)
Backend:
- PHP 7.4+
- MySQL 5.7+
- PDO (database)
- Apache
Development:
- Vite (build tool)
- XAMPP (local server)