Set up Network Locally on a Flash Drive

I’ve previously used WAMP for developing WordPress themes locally using a WordPress Network using sub domains. Having to set it all up again every time I want to develop on a new computer is a pain, so I decided i wanted to do a portable installation, this way the only file I have to change when using a different computer is the local HOSTS file.

I have Xampp portable running off a flash drive just fine. I also have WordPress 3.5.1 running on said installation just fine. However, when I run through WordPress’s install to convert a clean WordPress installation to a WordPress Network (Add WP_Allow_multisite to the config, then run through WP’s network set up, copying the required settings to the required files), it just won’t take. The dashboard never adds the “My Sites” button to the dashboard, so I never get the ability to add new sites. (Yes, I tried clearing the Cache.) However when I go to Network setup again it does recognize that a network exists.

Read More

I’m somewhat familiar with WordPress’s MySQL tables, having poked through them before and manually edited values when moving installations between local and remote. When I checked the databases on one of these failed installations, it seems to me like some of the necessary tables for a WordPress network aren’t being created during the Network installation.

I spend around 3 hours double checking my hosts and VHosts, deleting the database, and reinstalling WP form scratch multiple times. As much as I love solving my own problems, it’s time to ask others to look over what I have.

Here’s the files I am working with:

httpd-vhosts.conf

NameVirtualHost *:80

  <VirtualHost *:80>
    DocumentRoot "/xampp-portable/htdocs"
    ServerName localhost
  </VirtualHost>

  <VirtualHost *:80>
    DocumentRoot "/xampp-portable/htdocs/mysite"
    ServerName mysite.loc
    ServerAlias *.mysite.loc
    <Directory "/xampp-portable/htdocs/mysite">
     Options Indexes FollowSymLinks Includes
     AllowOverride All
     Order allow,deny
     Allow from all
    </Directory>
  </VirtualHost>

Windows HOSTS files

127.0.0.1       localhost

127.0.0.1       mysite.loc
127.0.0.1       www.mysite.loc
127.0.0.1       site1.mysite.loc
127.0.0.1       *.mysite.loc

wp-config.php

<?php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'gmi_main_wp');

/** MySQL database username */
define('DB_USER', 'mysite_admin');

/** MySQL database password */
define('DB_PASSWORD', 'censored');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

/**#@+
 * Authentication Unique Keys and Salts.
 *
 * Change these to different unique phrases!
 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
 *
 * @since 2.6.0
 */
define('AUTH_KEY',         'jo`QznTiAC3?a/V($j9]3e){#*-IAK=ifHIOLk$bryzLCMtp@&`&EI@)r-i>$@vW');
define('SECURE_AUTH_KEY',  'HCm0;@[bv0 }tKMR~dtl6fZMQC-T6} k^tyP& nP7%s.ut ]R<:fO5+8jG$BX$6T');
define('LOGGED_IN_KEY',    'hkg@N&?;$}mq>qL`o&0*Ni<:Oc=K#)d:a`.pdareq`n0&;X6/o|6g2aCd#%jee%D');
define('NONCE_KEY',        'BZN6oCg7(.|$,Wsf!+4%KT,Xc=G&yLRE&283[<_;8 ~L9+HQ6?>AD~1O$6@AN1;;');
define('AUTH_SALT',        'y7Xx}F+U8hoMke-y|s!Mqum2GjSGoSi)As$]0%vqpZj/Gmg+-u_K+x6z(@^X@sTB');
define('SECURE_AUTH_SALT', '1(e`{l$EzdRjkQ}s9Z<g:fa|6X$RHz7d?L5r5q#O(EiVi&]03lgl{D~:~lM)jYF-');
define('LOGGED_IN_SALT',   'GhJ)gh7q3Vfl~zL,Ct1AoWt?gj5EhTcxI;:}?V^G#]354SIGg/;8+S=,qC_F%f2V');
define('NONCE_SALT',       'd2ee=WxWsm`^+KO}6$#fQ[S3fTGWy n$5`/0.fpK|nU1dq>e8j(.[7X!wS)[e>e}');

/**#@-*/

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'main_wp_';

/**
 * WordPress Localized Language, defaults to English.
 *
 * Change this to localize WordPress. A corresponding MO file for the chosen
 * language must be installed to wp-content/languages. For example, install
 * de_DE.mo to wp-content/languages and set WPLANG to 'de_DE' to enable German
 * language support.
 */
define('WPLANG', '');

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 */
define('WP_DEBUG', false);

/* 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');

/* Multisite */
//define('WP_SITEURL','http://mysite.loc');
//define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'mysite.loc');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

.htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]

And finally a picture of the db Tables. I feel like some tables that should have been created are missing:

http://i.minus.com/i48qe2OEU9A3d.png

Edit:

I enabled debug and now get the error “Constant MULTISITE already defined” on line 95. Line 95 is the line where I have define(‘MULTISITE’, true). I’m wondering if somehow is_multisite() is returning false, causing the wp_settings file to echo define(‘MULTISITE’, false), which causes the error.

And THAT leads me to suspect that files like load.php and functions.php are not working properly… which points to my permissions set in the vhosts file. I’m using relative paths due to this being a flash drive install. And that is something that is different from previous installs.

Related posts

Leave a Reply

1 comment

  1. The solution: I pasted the block of Mutisite code below the “That’s all, stop editing! Happy blogging.” line. I’d installed multisite so often that I didn’t pay attention to that part.

    So if you ever think you’ve installed multisite correctly but the My Sites button never appears, you’ve pasted the definitions too far down in the file.