diff --git a/debug/debug-network-update.md b/debug/debug-network-update.md new file mode 100644 index 00000000..6074ad42 --- /dev/null +++ b/debug/debug-network-update.md @@ -0,0 +1,135 @@ +# Debugging a WordPress Network + +If you have reached this page, chances are you have received an error while setting up or running a [WordPress Multisite Network](https://wordpress.org/documentation/article/multisite-network-administration/). These errors often occur when WordPress cannot find one or more of the required global tables for the network in the database or when the web server is not configured correctly. + +This guide outlines the most common causes and fixes for WordPress Network (Multisite) setup or runtime issues. + +--- + +## Before You Begin {#before-you-begin} +- **Back up your database and files** before making changes. +- Ensure your hosting environment meets the [technical requirements for Multisite](https://developer.wordpress.org/advanced-administration/multisite/create-network/). +- Check with your host if they allow network/multisite installations (some shared hosts may restrict this). + +--- + +## If You Just Installed Your Network {#new-install} + +### Verify wp-config.php {#verify-wp-config} +Check your [wp-config.php](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/) file for: + +- Correct database details (`DB_NAME`, `DB_USER`, `DB_PASSWORD`, `DB_HOST`) +- The `MULTISITE` constant +- The `SUBDOMAIN_INSTALL` constant (true/false depending on setup) +- The `$base` variable +- The table prefix (`$table_prefix`) + +Ensure no code is placed after the following block: + +```php +/* That's all, stop editing! Happy publishing. */ + +/** Absolute path to the WordPress directory. */ +if ( ! defined('ABSPATH') ) { + define('ABSPATH', __DIR__ . '/'); +} + +/** Sets up WordPress vars and included files. */ +require_once ABSPATH . 'wp-settings.php'; +``` + +If you find custom code *after* the `require_once` line, move it above the "stop editing" comment. + +--- + +### Mod_rewrite or Rewrites Not Working {#rewrites} + +If your main site loads but child sites return 404 errors, your rewrite rules may not be active. + +#### Apache +On Ubuntu/Debian systems: + +```bash +sudo a2enmod rewrite +sudo nano /etc/apache2/sites-available/000-default.conf +``` + +Change both instances of `AllowOverride None` to `AllowOverride All`, then restart Apache: + +```bash +sudo systemctl restart apache2 +``` + +#### Nginx +For Nginx, ensure your server block includes: + +```nginx +location / { + try_files $uri $uri/ /index.php?$args; +} +``` + +Restart Nginx: + +```bash +sudo systemctl restart nginx +``` + +--- + +### Check the Database {#check-database} + +Multisite requires additional database tables. Confirm that the following exist (with your prefix, e.g., `wp_`): + +- `wp_blogs` +- `wp_blogmeta` +- `wp_blog_versions` +- `wp_registration_log` +- `wp_signups` +- `wp_site` +- `wp_sitemeta` + +If tables are missing, or `wp_site`/`wp_blogs` are empty, you may need to insert rows manually. **Back up first!** + +Example SQL (adjust prefix, domain, path, user, and dates): + +```sql +INSERT INTO wp_site VALUES (1, 'example.com', '/'); +INSERT INTO wp_blogs VALUES (1, 1, 'example.com', '/', '2025-01-01', '2025-01-01', 1, 0, 0, 0, 0, 0); +INSERT INTO wp_sitemeta VALUES (1, 1, 'site_admins', 'a:1:{i:1;s:5:"admin";}'); +``` + +⚠️ Change `"admin"` to your actual username, and adjust `s:5` to match its character length. + +--- + +## If New Site Creation Suddenly Stops Working {#site-creation-stopped} +- Confirm the database server hostname has not changed (check `DB_HOST` in `wp-config.php`). +- Check that the database user has **ALL privileges** on the database. +- Review web server error logs for `.htaccess` or rewrite-related issues. + +--- + +## Other Issues {#other-issues} +- **Database Collation Conflicts**: Rarely seen today, but legacy upgrades from WordPress MU may cause site creation errors due to collation mismatches. Check your database collation settings if upgrading from very old versions. +- **Apache Rewrite Restrictions**: If you see errors like: + + ``` + Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden + ``` + + This may prevent rewrites and cause WordPress to report missing tables. Update your Apache configuration to allow rewrites. + +--- + +## Related Articles {#related-articles} +- [WordPress Multisite Network: A Complete Guide](https://multilingualpress.org/wordpress-multisite-network/) +- [Hardening WordPress Multisite](https://developer.wordpress.org/advanced-administration/security/hardening/) + +## External Links {#external-links} +- [WordPress Support → Multisite Forum](https://wordpress.org/support/forum/multisite/) + +--- + +## Legacy Notes {#legacy-notes} +Some issues date back to migrations from WordPress MU (pre‑3.0). These are rare in modern networks but may still appear when running very old sites. Where possible, consider migrating to a fresh Multisite install. diff --git a/debug/debug-network.md b/debug/debug-network.md deleted file mode 100644 index 8bba501e..00000000 --- a/debug/debug-network.md +++ /dev/null @@ -1,116 +0,0 @@ -# Debugging a WordPress Network - -## Debugging a WordPress Network - -If you have reached this page, chances are you have received an error in your [WordPress network](https://wordpress.org/documentation/article/multisite-network-administration/). This failure occurs when WordPress cannot find one or more of the global tables for the network in the database. - -On some shared web hosts, the host has disabled the functionality from running. It is always best to check with your web host **before** [creating a network](https://developer.wordpress.org/advanced-administration/multisite/create-network/) to make sure your web host account fulfills the technical requirements. - -## If You just installed your network - -Check your [wp-config.php](https://developer.wordpress.org/advanced-administration/wordpress/wp-config/) file for: - -- correct database details -- `SUBDOMAIN_INSTALL` constant -- `MULTISITE` constant -- `$base` variable -- table prefix - -You should not have anything after - -``` -/* That's all, stop editing! Happy blogging. */ - -/** Absolute path to the WordPress directory. */ -if ( !defined('ABSPATH') ) - define('ABSPATH', dirname(__FILE__) . '/'); - -/** Sets up WordPress vars and included files. */ -require_once(ABSPATH . 'wp-settings.php'); -``` - -Move any code that is after - -``` -require_once(ABSPATH . 'wp-settings.php'); -``` - -to above the stop editing line. - -### Mod_rewrite not working - -The main site works, but 404 errors show up when trying to access added child subdomain sites. An Ubuntu with Apache HTTPD installation needs these steps: - -``` -sudo a2enmod rewrite -sudo nano /etc/apache2/sites-avail/default -``` - -and change in two places the 'AllowOverride None' to 'AllowOverride all' - -``` -/etc/init.d/apache2 restart -``` - -to restart apache2. Note that on more modern versions of Ubuntu the following syntax is preferred (for restarting services such as Apache – also note that in either case you may need to use prepend _sudo_): - -``` -service apache2 restart -``` - -### Check the database - -Assuming all that is correct, check the database itself and see if [all the extra network tables](https://codex.wordpress.org/Database_Description#Multisite_Table_Overview) were created. The tables are: - -- wp_blogs -- wp_blogmeta -- wp_blog_versions -- wp_registration_log -- wp_signups -- wp_site -- wp_sitemeta - -If you have these DB tables or added them manually but wp_site and/or wp_blogs is empty, you may have to run some SQL queries to insert rows for your main site. Be sure to adjust the table prefixes, domains, dates, username, and other parts of the queries below to match your installation. - -``` -INSERT INTO wp_site VALUES ( 1, 'domain.com', '/' ); -# change domain.com to the full domain of your original site and / to the path - -INSERT INTO wp_blogs VALUES( 1, 1, 'domain.com', '/', '2015-01-01', '2015-01-01', 1, 0, 0, 0, 0, 0 ); -# change domains.com and / to domain and path of your site. Change dates if you want. - -INSERT INTO wp_sitemeta VALUES( 1, 1, 'site_admins', 'a:1:{i:1;s:5:"admin";}' ); -# Sets the admin user as a Super Admin. Change "admin" to your user_login. -# Change "s:5" to "s:#" where # is the number of characters in user_login. -``` - -## If new site creation suddenly stopped working - -Please take a look at your database as above. Double-check that the location of the database server hasn't changed, or is so, that you've updated your `wp-config.php` file. - -## Other lesser-known issues - -Check that the database user has ALL permissions on the database. - -Also, on very few upgrades from WordPressMU to 3.0 and up, a few users experienced a problem with creating new sites and receiving errors. This turned out to be a database collation issue. - -Check that the `.htaccess` instructions are not throwing up errors in the Apache logs. - -Like this one: - -``` -Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: - -This will result in a Network install appearing to fail and may show WP errors like - -One or more database tables are unavailable. The database may need to be repaired. -``` - -## Related Articles - -* [WordPress Multisite Network: A Complete Guide](https://multilingualpress.org/wordpress-multisite-network/) - -## External Links - -* [WordPress → Support → Multisite](https://wordpress.org/support/forum/multisite/) -