本地主机响应弃用警告



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

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

已弃用:mysql_connect():mysql 扩展已弃用,并且 将来将被删除:使用 mysqli 或 PDO 代替 /Applications/MAMP/htdocs/lifefarout/www/wp-include/wp-db.php on online 1142

警告:无法修改标头信息 - 标头已由 发送 (输出开始于 /Applications/MAMP/htdocs/lifefarout/www/wp-include/wp-db.php:1142) 在 /Applications/MAMP/htdocs/lifefarout/www/wp-include/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]

我对堆栈溢出仍然很陌生,任何帮助将不胜感激。我对WP很陌生,所以我确定我缺少一些东西。

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

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

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

关于 mysql_connect() 的警告意味着您正在运行的 PHP 版本认为"mysql"扩展已被弃用,并建议其他扩展。因此,在未来的PHP版本中,此版本的Wordpress将无法工作,除非配置为使用这些其他扩展(如果可能的话)。

但是,此警告只是一个警告,与其他错误"未找到"无关。

您可以在关闭WordPress的调试模式时隐藏此消息。

改变

define('WP_DEBUG', 'true');

define('WP_DEBUG', 'false');

要在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

相关内容

最新更新