0

我试图完成的事情似乎很困难。我想将我的 wordpress 实时版本拉到我的本地机器上并在 localhost 上运行它,这样我就可以玩主题并在 Dreamweaver 等中进行编辑。我应该注意这是多站点 wp 刚刚更新到 3.6.1 的最新版本

我遇到的问题是,即使 localhost 将我的根文件夹识别为位于正确的位置,它也不会打开并运行该站点。我收到了一系列错误,包括“在此服务器上找不到请求的 URL/wp-signup.php”,而最近的错误是一个奇怪的错误。

不推荐使用:mysql_connect():不推荐使用 mysql 扩展并将在将来删除:在第 1142 行的 /Applications/MAMP/htdocs/lifefarout/www/wp-includes/wp-db.php 中使用 mysqli 或 PDO 代替

警告:无法修改标头信息 - 标头已由 /Applications/MAMP/htdocs/lifefarout/www/ 中的 /Applications/MAMP/htdocs/lifefarout/www/wp-includes/wp-db.php:1142 发送的标头wp-includes/ms-settings.php 在第 91 行

这是第 1142 行

$this->dbh = mysql_connect( $this->dbhost, $this->dbuser, $this->dbpassword, $new_link, $client_flags );

这是第 91 行

header( 'Location: ' . $destination );

我的机器:OSX 10.8.5,MAMP 2.2 版(apache 和 Mysql 都在正常运行)

到目前为止我所做的:使用 ftp 将 www/ 文件夹传输到 MAMP 指向的本地计算机上的 .htdocs 文件夹。使用 phpmyadmin 从服务器备份 .sql 数据库。在本地 phpmyadmin 上创建了一个与我导出的名称相同的数据库。导入的数据库。创建了一个用户。调整 wp-config.php 以阅读以下内容。

<?php
/**
 * The base configurations of the WordPress.
 *
 * This file has the following configurations: MySQL settings, Table Prefix,
 * Secret Keys, WordPress Language, and ABSPATH. You can find more information
 * by visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing
 * wp-config.php} Codex page. You can get the MySQL settings from your web host.
 *
 * This file is used by the wp-config.php creation script during the
 * installation. You don't have to use the web site, you can just copy this file
 * to "wp-config.php" and fill in the values.
 *
 * @package WordPress
 */

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

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

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

/** 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',         '.*>a;snGx`hMa6&2|X$3g/:k3k6FYF]Z|+K1[>vADAQ/KHt]S:0WBLq|T-m>1Co7');
define('SECURE_AUTH_KEY',  'x+Xphn TxO|<h -M>o|sOG2iyic*}oWpf71jsd&|ma5x;b6Q,*47ZPgpPrZnb ]#');
define('LOGGED_IN_KEY',    'v?o{lCRqbMf)_rrq*c8z3Ey!*e>&d+Ee<K{aWUfnF@i%#j|A8rBv(9u7i@l ]-0t');
define('NONCE_KEY',        'PFj08]|>D[p?b+|Iz8%8-N>-#k+9>Li-1v<e;l2=-TOBnt&rRA-ZK/|Pk#v1r-h_');
define('AUTH_SALT',        'WEj#d~*= |!3uwI`~;@*+5I_WD7[4_0X_3=5Ev*zL^Cr+guSLu-U3(+HewIO:-QV');
define('SECURE_AUTH_SALT', '_I(.y=F`$PUe}-d~||u%`E6DO!|H^r00EK>/T((M*F<-n0B|b5$^GjUAeokg:<gW');
define('LOGGED_IN_SALT',   'w(4G,N.#@a!>~Svw|h[|-AI`}?OyYxs3FT)O2:FydEWx?M@Pmm8u!ik.$fRov0|r');
define('NONCE_SALT',       '2<aWfduVE8Anry(E jTg+(*%cE{-z0p_<V .FOe}xW}8-@(5mTpU3%J5n:Xc]+Gr');

/**#@-*/

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

define('WP_ALLOW_MULTISITE', 'true');

define('MULTISITE', 'true');
define('SUBDOMAIN_INSTALL', 'false');
define('DOMAIN_CURRENT_SITE', 'localhost');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

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

我还编辑了我的 .htaccess 以阅读以下内容:

# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini

# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>

# END WordPress
RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.co$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lfarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.info$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.me$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.mobi$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.net$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.org$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^mylfo\.mobi$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^mylfo\.net$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^mylifefarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^ourlfo\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^eventsfarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^livefarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^livingfarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.us$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifefarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^livelifefarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

RewriteCond %{HTTP_HOST} ^lifefarout\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.lifefarout\.com$
RewriteRule ^lifeisfarout\.com$ "http\:\/\/lifefarout\.com\/" [R=301,L]

我对stackoverflow还是很陌生,任何帮助将不胜感激。我对 WP 很陌生,所以我确定我缺少一些东西。

如果您需要更多信息或希望我分享其他文件,请告诉我,我很乐意为您提供帮助!提前致谢。

4

4 回答 4

1

我正在使用 OSX (10.9)、Mamp (Pro v2.2) - 转到“服务器”选项卡并在“PHP”下将版本更改为 5.4.x -它将停止调试警告消息。

您正在使用生成这些警告的 PHP 5.5.x(Mamp 安装的默认设置)。

于 2013-11-13T22:12:25.550 回答
0

The warning about mysql_connect() means that the version of PHP you are running, considers the "mysql" extension as being deprecated and suggests other extensions. So in a future PHP version, this version of Wordpress won't work, unless configured to use these other extensions (if that's possible).

However this warning is just a warning and is not related with the other error "not found".

于 2013-10-13T13:16:45.390 回答
0

要更改 WordPress 中的错误警告,您可以WP_DEBUG设置为 true 执行以下操作。

  1. 在您的wp-content文件夹中创建一个名为mu-plugins
  2. 在此文件夹中创建一个包含您要使用的错误级别的 php 文件。

例如:

 //turns off deprecated and strict errors
    error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);

您可以在此处查看列表:http ://www.php.net/manual/en/errorfunc.constants.php

于 2013-12-31T17:53:53.933 回答
0

您可以通过关闭 WordPress 的调试模式来隐藏此消息。

改变

define('WP_DEBUG', 'true');

define('WP_DEBUG', 'false');
于 2013-11-09T11:46:16.720 回答