Problem
WordPress apps on DigitalOcean App Platform are failing because they don't have wp-config.php files in their GitHub repositories.
Solution
Add a script that auto-generates wp-config.php from environment variables during deployment.
Step 1: Add Files to Each GitHub Repo
For each WordPress site (e.g., Independent-Business-Group/wordpress-performwritecom):
- Add the script file: create-wp-config-from-env.php
- Location: Root of the repository
- Content: See /home/cw/Documents/IBG_HUB/rmm-psa-devops/wordpress-templates/create-wp-config-from-env.php
- Add/Modify .gitignore to exclude generated wp-config.php:
- Create a .do/deploy.sh file (DigitalOcean App Platform pre-deploy script):
#!/bin/bash
set -e
echo "Generating wp-config.php from environment variables..."
php create-wp-config-from-env.php
if [ ! -f wp-config.php ]; then
echo "ERROR: wp-config.php was not created!"
exit 1
fi
echo "wp-config.php generated successfully"
ls -la wp-config.php
- Make the script executable:
Step 2: Update App Spec (Optional)
If .do/deploy.sh doesn't run automatically, update the app spec to include a pre-deploy command:
doctl apps update YOUR_APP_ID --spec - <<EOF
# ... existing spec ...
services:
- name: web
# ... existing config ...
run_command: |
php create-wp-config-from-env.php && vendor/bin/heroku-php-apache2
EOF
Step 3: Fix Database URLs
Each database still has production URLs that need to be updated to match the App Platform URLs:
# For each site, update the URLs in the database:
mysql -h wordpress-mysql-cluster-do-user-28531160-0.i.db.ondigitalocean.com \
-P 25060 -u doadmin -p'AVNS_fgu8gFvgx0amcAQ4VBt' --ssl \
YOUR_DATABASE_NAME -e "
UPDATE TABLE_PREFIX_options
SET option_value = 'https://YOUR-APP-URL.ondigitalocean.app'
WHERE option_name IN ('siteurl', 'home');
"
Example for performwritecom:
mysql -h wordpress-mysql-cluster-do-user-28531160-0.i.db.ondigitalocean.com \
-P 25060 -u doadmin -p'AVNS_fgu8gFvgx0amcAQ4VBt' --ssl \
performwritecom_wp -e "
UPDATE xfwlw_options
SET option_value = 'https://wordpress-performwritecom-7alzt.ondigitalocean.app'
WHERE option_name IN ('siteurl', 'home');
SELECT option_name, option_value FROM xfwlw_options WHERE option_name IN ('siteurl', 'home');
"
Step 4: Deploy and Test
- Push changes to GitHub:
git add create-wp-config-from-env.php .do/deploy.sh .gitignore
git commit -m "Add auto-generated wp-config from environment variables"
git push origin main
- Monitor deployment:
doctl apps get YOUR_APP_ID
doctl apps logs YOUR_APP_ID --tail 100
- Test the site:
curl -I https://YOUR-APP-URL.ondigitalocean.app
All Sites Requiring This Fix
| Site | GitHub Repo | App ID | Database | Table Prefix | App URL |
| performwrite.com.au | Independent-Business-Group/wordpress-performwritecom | 5c0a7a18-4ff0-4027-b47c-c45e89d7a989 | performwritecom_wp | xfwlw_ | wordpress-performwritecom-7alzt.ondigitalocean.app |
| supportfornewmums.info | Independent-Business-Group/wordpress-sfnm | cdc99dbc-1d15-4ff6-b65d-f26bfe8e8e18 | sfnm_wp | wp_ | wordpress-sfnm-j9jlc.ondigitalocean.app |
| redhealer.com.au | Independent-Business-Group/wordpress-redheale | 5ba2f911-9729-40eb-bc37-56c971d72bca | redheale_wp | wp_ | wordpress-redheale-ydxti.ondigitalocean.app |
| path2u.com.au | Independent-Business-Group/wordpress-path2ucom | ac5f79fe-ab05-4e18-9dea-9d6ab82186b2 | path2ucom_wp | wp_ | wordpress-path2ucom-4efh5.ondigitalocean.app |
| outdoorism.com.au | Independent-Business-Group/wordpress-outdoor1 | e1392cdf-d13b-4ef9-90ca-5f54830b74ba | outdoor1_wp | wp_ | wordpress-outdoor1-gm7v3.ondigitalocean.app |
| murwillumbahchamber.com.au | Independent-Business-Group/wordpress-murwillu | (ID needed) | murwillu_wp | wp_ | wordpress-murwillu-vaqze.ondigitalocean.app |
| murwillumbahmowers.com.au | Independent-Business-Group/wordpress-murbahmowers | (ID needed) | murbahmowers_wp | wp_ | wordpress-murbahmowers-aayja.ondigitalocean.app |
| laser-x-perts.com.au | Independent-Business-Group/wordpress-laserxperts | (ID needed) | laserxperts_wp | wp_ | wordpress-laserxperts-8bflc.ondigitalocean.app |
| kandudeliveries.com.au | Independent-Business-Group/wordpress-kandudeliveriesc | (ID needed) | kandudeliveriesc_wp | wp_ | wordpress-kandudeliveriesc-m7w54.ondigitalocean.app |
| handsofdestiny.com.au | Independent-Business-Group/wordpress-handsofd | (ID needed) | handsofd_wp | wp_ | wordpress-handsofd-jk58l.ondigitalocean.app |
| cornerstone-constructions.com.au | Independent-Business-Group/wordpress-corne582 | (ID needed) | corne582_wp | wp_ | wordpress-corne582-xnahs.ondigitalocean.app |
| comsmta.org | Independent-Business-Group/wordpress-collegeo | 94cddf95-e84f-4200-be9a-eff69628279f | collegeo_wp | ESM9jSdEi_ | (No URL - needs ingress fix) |
Alternative: Manual wp-config Upload
If you don't want to modify the GitHub repos, you can manually create wp-config.php in each app:
- Connect to app console:
doctl apps console YOUR_APP_ID
- Create wp-config.php:
php create-wp-config-from-env.php
Note: This is temporary - the file will be overwritten on next deployment.
Verification Checklist
After deployment, verify each site:
- wp-config.php is created (check logs)
- Site loads without redirect to install.php or setup-config.php
- Database connection works
- Media/images load correctly
- Frontend displays properly
Troubleshooting
Site still redirects to install.php
- Check database URLs are correct (siteurl and home options)
- Verify wp-config.php was created (check deployment logs)
Database connection errors
- Verify environment variables are set correctly in App Platform
- Check database user exists and has permissions
- Ensure SSL connection is enabled
504/503 errors
- Check app logs: doctl apps logs APP_ID --tail 100
- Verify PHP-FPM is starting correctly
- Check for PHP errors in logs
wp-config.php not generated
- Ensure create-wp-config-from-env.php is in repository root
- Check pre-deploy script permissions
- Review build logs for errors
Next Steps After Sites Are Working
- Security: Create isolated database users (see WORDPRESS_MIGRATION_TODO.md section 2)
- Security: Create separate DO Spaces buckets (see WORDPRESS_MIGRATION_TODO.md section 3)
- Deploy missing 4 apps (coomerawatersrea, pits, soilife, vastcons)
- Fix collegeo app (no ingress configured)
- Migrate DNS to production domains
- Set up monitoring and automated backups
Created: 2026-02-17
Last Updated: 2026-02-17
Status: Ready to implement