• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「wp-config.php の編集」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Editing wp-config.php 18:43, 19 Jun 2007 MichaelH(リバート大元は 06:37, 6 Aug 2006 Fenix9158)の版)
 
(HelpHub 移動メッセージで置き換え。)
 
(20人の利用者による、間の100版が非表示)
1行目: 1行目:
原文・最新版: [http://codex.wordpress.org/Editing_wp-config.php WordPress Codex » Editing wp-config.php]
+
このページは https://ja.wordpress.org/support/article/editing-wp-config-php/ へ移動しました。
 
+
As part of the WordPress installation, you must modify the <tt>wp-config.php</tt> file to define the WordPress configuration settings required to access your MySQL database.
+
 
+
This file, <tt>wp-config.php</tt>, does not exist in a downloaded copy of WordPress; you need to create it. The <tt>wp-config-sample.php</tt> file is provided as an example to work from.
+
 
+
To change the <tt>wp-config.php</tt> file for your installation, you will need this information:
+
 
+
* Database Name
+
* Database Username
+
* Database Password
+
* Database Host
+
 
+
If your hosting provider installed WordPress for you, get the information from them. If you manage your own web server or hosting account, you will have this information as a result of creating the database and user (see [[Installing_WordPress#Step_2:_Create_the_Database_and_a_User|Installing WordPress, Create the Database and User]]).
+
 
+
== Creating the file ==
+
Open the file <tt>wp-config-sample.php</tt> in a [[Glossary#Text_editor|text editor]].
+
 
+
'''Important:''' ''never'' use a word processor like Microsoft Word for editing WordPress files!
+
 
+
=== Database name ===
+
Find the line that says:
+
 
+
define('DB_NAME', 'wordpress'); // The name of the database
+
 
+
('''NOTE:''' Everything on these lines you see after the <tt>//</tt> are comments for information purposes only.)
+
 
+
Where it says <tt>'wordpress'</tt>, delete ''wordpress'' and enter the name of your database. '''Make sure that you don't accidentally delete the single quotation marks!'''
+
 
+
The line should look like this:
+
 
+
define('DB_NAME', 'myDatabaseName'); // The name of the database
+
 
+
=== Database user name ===
+
define('DB_USER', 'username'); // Your MySQL username
+
Delete ''username'' and enter in your own username:
+
define('DB_USER', 'myDatabaseUser'); // Your MySQL username
+
 
+
=== Database password ===
+
On to the next one:
+
define('DB_PASSWORD', 'password'); // ...and password
+
Delete ''password'' and enter in your MySQL password:
+
define('DB_PASSWORD', 'aIg8Dj39K1sUvU303a8lE4kwQ9E'); // ...and password
+
 
+
This is only an example password, of course! :)
+
 
+
===Database host===
+
The next line under the password line defines the host for your database.  There is a 99% chance you will '''NOT''' have to change it unless your web host tells you otherwise. In other words, you can likely leave it as the default value of <tt>'localhost'</tt>. 
+
 
+
If your database host is different than <tt>'localhost'</tt>, move down to the next line:
+
 
+
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
+
Delete ''localhost'' and enter in your database host as direct by your web host:
+
define('DB_HOST', 'mysql34.myhostserver');    // 99% chance you won't need to change this value
+
 
+
Of course, the '''mysql34.myhostserver''' will be different for you.
+
 
+
===Database character set===
+
As of WordPress [[Version 2.2|Version 2.2]], '''DB_CHARSET''' was made available to allow designation of the database [[Glossary#Character Set|character set]] (e.g. tis620 for TIS620 Thai) to be used when defining the MySQL database tables.  The default value of '''utf8''' ([[Wikipedia:Unicode|Unicode]] [[Wikipedia:UTF-8|UTF-8]]) should NOT BE CHANGED without careful understanding of the outcome.  Please note that UTF-8 supports many European languages so leave DB_CHARSET at '''utf8''' and use the appropriate [[#Database collation|DB COLLATE]] value for your language.
+
 
+
*'''Warning for those performing new installations''': For most Western European languages, including English, there usually should be no reason to change the default value of DB_CHARSET.  If your blog needs a different character set, please read [http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html Character Sets and Collations That MySQL Supports] for the valid values for DB_CHARSET.
+
*'''Warning for those performing upgrades''':  If DB_CHARSET and DB_COLLATE do not exist in your <tt>wp-config.php</tt> file, DO NOT add  either definition to your <tt>wp-config.php</tt> file unless you read and understand [[Converting Database Character Sets]].  Adding DB_CHARSET and DB_COLLATE to the <tt>wp-config.php</tt> file, for an existing blog, can cause problems &mdash; as Ryan Boren says, "your queries will go boom!"
+
This example shows utf8 which is considered the WordPress default value:
+
<pre>
+
define('DB_CHARSET', 'utf8');
+
</pre>
+
 
+
===Database collation===
+
As of WordPress [[Version 2.2|Version 2.2]], '''DB_COLLATE''' was made available to allow designation of the database [[Glossary#Collation|collation]] (i.e. the sort order of the character set).  In most cases, this value should be left blank (null) so the database collation will be automatically assigned by MySQL based on the database character set (i.e. DB_CHARSET). Set '''DB_COLLATE''' to one of the UTF-8 values defined in [http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html Unicode character sets (utf8 section)] for most Western European languages. 
+
 
+
*'''Warning for those performing new installations''': There usually should be no reason to change the default value of DB_COLLATE.  Leaving the value blank (null) will insure the collation is automatically assigned by MySQL when the database tables are created.
+
*'''Warning for those performing upgrades''':  If DB_COLLATE and DB_CHARSET do not exist in your <tt>wp-config.php</tt> file, DO NOT add  either definition to your <tt>wp-config.php</tt> file unless you read and understand [[Converting Database Character Sets]].  Adding DB_COLLATE and DB_CHARSET to the <tt>wp-config.php</tt> file, for an existing blog, can cause problems &mdash; as Ryan Boren says, "your queries will go boom!"
+
 
+
This example is of the WordPress default DB_COLLATE value:
+
<pre>
+
define('DB_COLLATE', '');
+
</pre>
+
 
+
*Example if UTF-8 Unicode Turkish collation is needed (DB_CHARSET should be utf8):
+
<pre>
+
define('DB_COLLATE', 'utf8_turkish_ci');
+
</pre>
+
 
+
===$table_prefix===
+
The $table_prefix is the value placed in the front of your database tables.  Change the value if you want to use something different than '''wp_''' for your database prefix.  Typically this is changed if you are [[Installing Multiple Blogs|installing multiple WordPress blogs]] in the same database. 
+
 
+
==Advanced Options==
+
===WordPress address (URL)===
+
Another new <tt>wp-config.php</tt> option, added as of WordPress [[Version 2.2|Version 2.2]], is '''WP_SITEURL'''.  This allows the WordPress address (URL) to be defined.  The valued defined is the address where your WordPress core files reside.  It should include the <nowiki>http://</nowiki> part too.  Do not put a backslash "'''/'''" at the end.  Setting this value in <tt>wp-config.php</tt> causes the [[Database_Description#Table:_wp_options|wp_options table]] option_value of '''siteurl''' to be set and disables the WordPress address (URL) field in the [[Administration_Panels|Administration]] > [[Administration_Panels#General|Options]] > [[General_Options_SubPanel|General]] panel.   
+
 
+
If you have installed WordPress into a directory called "wordpress" in a [http://en.wikipedia.org/wiki/Domain_name_system domain name] called "sample.com", define WP_SITEURL as this example does:
+
<pre>
+
define('WP_SITEURL', 'http://www.sample.com/wordpress');
+
</pre>
+
 
+
===Blog address (URL)===
+
'''WP_HOME''' is another <tt>wp-config.php</tt> option added in WordPress [[Version 2.2|Version 2.2]].  This allows the Blog address (URL) to be defined.  This is the address you want people to type in their browser to reach your WordPress blog. It should include the <nowiki>http://</nowiki> part.  Also, do not put a backslash "'''/'''" at the end.  Setting this value in <tt>wp-config.php</tt> causes the [[Database_Description#Table:_wp_options|wp_options table]] option_value of '''home''' to be set, and disables the Blog address (URL) field in the [[Administration_Panels|Administration]] > [[Administration_Panels#General|Options]] > [[General_Options_SubPanel|General]] panel.   
+
 
+
<pre>
+
define('WP_HOME', 'http://www.sample.com/wordpress');
+
</pre>
+
 
+
If you are using the technique described in [[Giving_WordPress_Its_Own_Directory|Giving WordPress Its Own Directory]] then follow the example below.  Remember, you will also be placing an <tt>index.php</tt> in your web-root directory if you use a setting like this.
+
<pre>
+
define('WP_HOME', 'http://www.sample.com');
+
</pre>
+
 
+
==Double Check Before Saving==
+
'''''Be sure to check for leading and/or trailing spaces around any of the above values you entered, and DON'T delete the single quotes!'''''
+
 
+
Before you save the file, be sure to '''double-check''' that you have not accidentally deleted any of the single quotes around the parameter values. Be sure there is nothing after the closing PHP tag in the file. The last thing in the file should be '''?>''' and nothing else. No spaces.
+
 
+
To save the file, choose '''File > Save As > wp-config.php''' and save the file in the root of your WordPress install. Upload the file to your web server and you're ready to install WordPress!
+
 
+
== Installing multiple Blogs ==
+
Multiple WordPress blogs require special handling of their configuration files.  Check [[Installing Multiple Blogs]] for more information.
+
 
+
[[Category:Getting Started]]
+

2020年3月20日 (金) 23:40時点における最新版

このページは https://ja.wordpress.org/support/article/editing-wp-config-php/ へ移動しました。