我之前使用WAMP通过使用子域的WordPress网络在本地开发WordPress主题。每次我想在一台新电脑上开发时都要重新设置这一切是一件痛苦的事,所以我决定要进行便携式安装,这样,当使用另一台电脑时,我唯一需要更改的文件就是本地主机文件。
我有一个Xampp便携式运行的闪存驱动器刚刚好。我也有WordPress 3.5.1在上述安装上运行得很好。然而,当我运行WordPress的安装程序以将干净的WordPress安装转换为WordPress网络时(将WP\\u Allow\\u multisite添加到配置中,然后运行WP的网络设置,将所需的设置复制到所需的文件),这根本不需要。仪表板从不将“我的站点”按钮添加到仪表板,因此我永远无法添加新站点。(是的,我试图清除缓存。)但是,当我再次转到网络设置时,它确实识别出网络存在。
我对WordPress的MySQL表有点熟悉,之前我浏览过这些表,并在本地和远程之间移动安装时手动编辑了值。当我检查其中一个失败安装上的数据库时,在我看来,WordPress网络的一些必要表似乎没有在网络安装期间创建。
我花了大约3个小时仔细检查我的主机和vhost,删除数据库,并多次重新安装WP form scratch。虽然我很喜欢解决自己的问题,但现在是时候让别人看看我的问题了。
以下是我正在处理的文件:
httpd VHOST。形态
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主机文件
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配置。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]
最后是db表的图片。我觉得缺少了一些本应创建的表:
http://i.minus.com/i48qe2OEU9A3d.png
编辑:
我启用了调试,现在在第95行得到错误“常数多站点已定义”。第95行是我定义的行(“MULTISITE”,true)。我想知道
is_multisite()
返回false,导致wp\\u设置文件回显define(\'MULTISITE\',false),从而导致错误。
这让我怀疑load.php
和functions.php
无法正常工作…这表明我在vhosts文件中设置了权限。我使用相对路径,因为这是一个闪存驱动器安装。这与以前的安装有所不同。