2012-12-23

Created page with "{{WarningMsg |Before editing this page. |Please, do not edit this Codex Page with the settings for your own server as you are giving the world access to your website's MySQL pass…"

New page

{{WarningMsg

|Before editing this page.

|Please, do not edit this Codex Page with the settings for your own server as you are giving the world access to your website's MySQL password, and will not make your install work. Thanks.}}

__TOC__

As part of the WordPress installation, you must modify the wp-config.php file to define the WordPress configuration settings required to access your MySQL database.

This file, wp-config.php, does not exist in a downloaded copy of WordPress; you need to create it. The wp-config-sample.php file is provided as an example to work from. Save it as wp-config.php before editing. Advanced settings and examples are provided below.

To change the wp-config.php file for your installation, you will need this information:

; '''Database Name''' : Database Name used by WordPress

; '''Database Username''' : Username used to access Database

; '''Database Password''' : Password used by Username to access Database

; '''Database Host''' : The hostname of your Database Server. A port number, Unix socket file path or pipe may be needed as well.

If your hosting provider installed WordPress for you, get the information from them. If you manage your own [[Glossary#Web server|web server]] or hosting account, you will have this information as a result of [[Installing_WordPress#Step_2:_Create_the_Database_and_a_User|creating the database and user]].

{{WarningMsg

|Before you modify the wp-config-sample.php file or an existing wp-config.php file:

|The contents of the wp-config-sample.php file are in a specific order. ''The order matters.'' If you already have a wp-config.php file, rearranging the contents of the file may create errors on your blog.}}

== Configurer les Paramètres de la Base de Données ==

'''Important:''' ''never'' use a word processor like Microsoft Word for editing WordPress files!

Locate the file {{Trac|wp-config-sample.php}} in the base directory of your WordPress directory and open in a [[Glossary#Text_editor|text editor]].

{{Note|Since [[Version 2.6]], [[#Moving wp-content|wp-config.php can be moved]] to the directory directly above the WordPress application directory.}}

=== Default wp-config-sample.php ===

This is an example of a default {{Trac|wp-config-sample.php}}. The values here are '''examples''' to show you what to do. You need to make changes on your own web site '''not''' here. If you make changes here by using the edit button, they will '''not''' work and you will be showing your password details to the world.

{{Template:SampleConnection}}

{{Note|Text inside /* */ are ''[http://www.php.net/manual/en/language.basic-syntax.comments.php comments]'', for information purposes only.}}

{{Note|Do not change these details here by editing this page, change them on your web server.}}

==== Définir le Nom de la Base de Données ====

Replace putyourdbnamehere, with the name of your database, e.g. ''MyDatabaseName''.

{{Template:SampleDBName}}

==== Définir le Compte Utilisateur de la Base de Données ====

Replace usernamehere, with the name of your username e.g. ''MyUserName''.

{{Template:SampleDBUser}}

==== Set Database Password ====

Replace yourpasswordhere, with the your password, e.g. ''MyPassWord''.

{{Template:SampleDBPassword}}

==== Définir l'hôte de la Base de Données ====

Replace localhost, with the name of your database host, e.g. ''MyDatabaseHost''. A port number or Unix socket file path may be needed as well.

{{Template:SampleDBHost}}

{{Note|There is a good chance you will '''NOT''' have to change it. If you are unsure, try installing with the default value of 'localhost' and see if it works. If the install fails, contact your web hosting provider.}}

=== Valeurs Possibles du DB_HOST ===

Different hosting companies use different network settings for their mysql databases. If your hosting company is listed below in the left column, the value on the right is similar to the correct value for DB_HOST. Contact your tech support and/or search your hosting companies online Documentation to be sure.

{| style="width:95%; margin:0 auto;" border="0" cellpadding="2"

|- align="center" bgcolor="#999" style="color:#fff" border="1"

! '''Hosting Company''' !! '''DB_HOST Value Guess'''

|-

|'''1and1''' || '''db12345678'''

|-

|'''AN Hosting''' || '''localhost'''

|-

|'''Aruba.it''' || '''localhost or real IP provided with activation mail.'''

|-

|'''A Small Orange''' || '''localhost'''

|-

|'''BlueHost''' || '''localhost'''

|-

|'''DreamHost''' || '''mysql.example.com'''

|-

|'''GoDaddy''' || '''Go to MySQL and edit the database to find the server name.'''

|-

|'''HostGator''' || '''localhost'''

|-

|'''HostICan''' || '''localhost'''

|-

|'''ICDSoft''' || '''localhost:/tmp/mysql5.sock'''

|-

|'''iPage''' || '''username.ipagemysql.com'''

|-

|'''IPower''' || '''username.ipowermysql.com'''

|-

|'''LaughingSquid''' || '''localhost'''

|-

|'''MediaTemple GridServer''' || '''internal-db.s44441.gridserver.com'''

|-

|'''MediaTemple (dv)''' || '''localhost'''

|-

|'''MegnaHost''' || '''localhost'''

|-

|'''NearlyFreeSpeech.Net''' || '''username.db'''

|-

|'''NetworkSolutions''' || '''mysqlv5'''

|-

|'''one.com''' || '''localhost'''

|-

|'''pair Networks''' || '''dbnnnx.pair.com'''

|-

|'''QTH.com''' || '''localhost'''

|-

|'''Rackspace Cloud''' || '''localhost for unmanaged servers, variable for Cloud Sites like mysqlXY-AB.wcN.dfQ.stabletransit.com where X,Y,A,B,N,Q are variables'''

|-

|'''SysFix.eu Power Hosting''' || '''datapower.sysfix.eu'''

|-

|'''Yahoo''' || '''mysql'''

|-

|'''Hosts with cPanel''' || '''localhost'''

|-

|'''Hosts with Plesk''' || '''localhost'''

|-

|'''Hosts with DirectAdmin''' || '''localhost'''

|-

|'''Tophost.it''' || '''sql.your-domain-name.it'''

|}

=== Port Alternatif de MySQL ===

If your host uses an alternate port number for your database you'll need to change the '''DB_HOST''' value in the wp-config.php file to reflect the alternate port provided by your host.

For localhost

define('DB_HOST', 'localhost:'''3307'''');

Other

define('DB_HOST', 'mysql.example.com:'''3307'''');

Replace '''3307''' with whatever port number you host gives you.

=== Sockets MySQL ou Pipes ===

If your host uses Unix sockets or pipes, adjust the '''DB_HOST''' value in the wp-config.php file accordingly.

define('DB_HOST', 'localhost:'''/var/run/mysqld/mysqld.sock'''');

Replace '''/var/run/mysqld/mysqld.sock''' with the socket or pipe information provided by your host.

=== Database character set ===

As of WordPress [[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]]) is almost always the best option. UTF-8 supports any language, so you typically want to leave DB_CHARSET at '''utf8''' and use the [[#Database collation|DB_COLLATE]] value for your language instead.

This example shows utf8 which is considered the WordPress default value:

define('DB_CHARSET', 'utf8');

{{WarningMsg|Those performing new installations

|There usuallly 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 MySQL Supports] for valid DB_CHARSET values.}}

{{WarningMsg|Those performing upgrades (especially blogs that existed before 2.2)

|If DB_CHARSET and DB_COLLATE do not exist in your wp-config.php file, '''DO NOT''' add either definition to your wp-config.php file unless you read and understand [[Converting Database Character Sets]]. Adding DB_CHARSET and DB_COLLATE to the wp-config.php file, for an existing blog, can cause major problems.}}

=== 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 specified by 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 UTF-8 character sets] for most Western European languages.

The WordPress default DB_COLLATE value:

define('DB_COLLATE', '');

UTF-8 Unicode General collation

define('DB_COLLATE', 'utf8_general_ci');

UTF-8 Unicode Turkish collation

define('DB_COLLATE', 'utf8_turkish_ci');

{{WarningMsg

|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.}}

{{WarningMsg

|Those performing upgrades (especially blogs that existed before 2.2)

|If DB_COLLATE and DB_CHARSET do not exist in your wp-config.php file, '''DO NOT''' add either definition to your wp-config.php file unless you read and understand [[Converting Database Character Sets]]. And you may be in need of a WordPress upgrade.}}

=== Clefs de Sécurité ===

In [[Version 2.6]], three (3) security keys, '''AUTH_KEY''', '''SECURE_AUTH_KEY''', and '''LOGGED_IN_KEY''', were added to ensure better encryption of information stored in the user's cookies. (These collectively replaced a single key introduced in [[Version 2.5]].) In [[Version 2.7]] a fourth key, '''NONCE_KEY''', was added to this group. When each key was added, corresponding salts were added: '''AUTH_SALT''', '''SECURE_AUTH_SALT''', '''LOGGED_IN_SALT''', and '''NONCE_SALT'''.

You don't have to remember the keys, just make them long, random and complicated -- or better yet, use the [https://api.wordpress.org/secret-key/1.1/salt/ the online generator]. You can change these at any point in time to invalidate all existing cookies. This does mean that all users will have to login again.

Example (don't use these!):

define('AUTH_KEY', 't`DK%X:>xy|e-Z(BXb/f(Ur`8#~UzUQG-^_Cs_GHs5U-&Wb?pgn^p8(2@}IcnCa|');

define('SECURE_AUTH_KEY', 'D&ovlU#|CvJ##uNq}bel+^MFtT&.b9{UvR]g%ixsXhGlRJ7q!h}XWdEC[BOKXssj');

define('LOGGED_IN_KEY', 'MGKi8Br(&{H*~&0s;{k0
(hdXW|0M=X={we6;Mpvtg+V.o
http://
part too. Do not put a slash "'''/'''" at the end. Setting this value in wp-config.php overrides the [[Database_Description#Table:_wp_options|wp_options table]] value for '''siteurl''' and disables the WordPress address (URL) field in the [[Administration_Panels|Administration]] > [[Administration_Panels#General|Settings]] > [[Settings_General_SubPanel|General]] panel.

{{Note|It won't change the Database value though, and the url will revert to the old database value if this line is removed from wp-config. [[Changing The Site URL#Relocate method|Use the '''RELOCATE''' constant]] to change the siteurl value in the database.}}

If WordPress is installed into a directory called "wordpress" for the [http://en.wikipedia.org/wiki/Domain_name_system domain]
example.com
, define WP_SITEURL like this:

define('WP_SITEURL', 'http://example.com/wordpress');

Dynamically set WP_SITEURL based on $_SERVER['HTTP_HOST']

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress');

{{Note|A safer alternative for some installations would be to use the server-generated SERVER_NAME instead of the php/user-generated HTTP_HOST which is created dynamically by php based on the value of the HTTP HOST Header in the request, thus possibly allowing for file inclusion vulnerabilities. SERVER_NAME is set by the server configuration and is static.}}

Dynamically set WP_SITEURL based on $_SERVER['SERVER_NAME']

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/path/to/wordpress');

=== Adresse du Blog (URL)===

'''WP_HOME''' is another wp-config.php option added in WordPress [[Version 2.2|Version 2.2]]. Similar to WP_SITEURL, WP_HOME ''overrides the [[Database_Description#Table:_wp_options|wp_options table]] value for ''home'' but does not change it permanently.'' '''home''' is the address you want people to type in their browser to reach your WordPress blog. It should include the
http://
part and should not have a slash "'''/'''" at the end.

define('WP_HOME', 'http://example.com/wordpress');

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 index.php in your web-root directory if you use a setting like this.

define('WP_HOME', 'http://example.com');

Dynamically set WP_HOME based on $_SERVER['HTTP_HOST']

define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress');

=== Déplacer le répertoire wp-content ===

Since [[Version 2.6]], you can move the wp-content directory, which holds your themes, plugins, and uploads, outside of the WordPress application directory.

Set WP_CONTENT_DIR to the full '''local path''' of this directory (no trailing slash), e.g.

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );

Set WP_CONTENT_URL to the full '''URI''' of this directory (no trailing slash), e.g.

define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');

=== Déplacer le Répertoire plugin ===

Set WP_PLUGIN_DIR to the full '''local path''' of this directory (no trailing slash), e.g.

define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

Set WP_PLUGIN_URL to the full '''URI''' of this directory (no trailing slash), e.g.

define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');

If you have compability issues with plugins

Set PLUGINDIR to the full '''local path''' of this directory (no trailing slash), e.g.

define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

=== Déplacer le Répertoire themes ===

=== Déplacer le Répertoire uploads ===

Set UPLOADS to :

define( 'UPLOADS', '/blog/wp-content/uploads' );

=== Modifier l'Intervalle de Sauvegarde Automatique ===

When editing a post, WordPress uses Ajax to auto-save revisions to the post as you edit. You may want to increase this setting for longer delays in between auto-saves, or decrease the setting to make sure you never lose changes. The default is 60 seconds.

define('AUTOSAVE_INTERVAL', 160 ); // seconds

=== Révisions des Articles ===

WordPress, by default, will save copies of each edit made to a post or page, allowing the possibility of reverting to a previous version of that post or page. The saving of revisions can be disabled, or a maximum number of revisions per post or page can be specified.

==== Désactiver la Revision des Articles ====

If you do '''not''' set this value, WordPress defaults WP_POST_REVISIONS to ''true'' (enable post revisions). If you want to disable the awesome revisions feature, use this setting:

define('WP_POST_REVISIONS', false );

==== Spécifier le Nombre de Révision des Articles ====

If you want to specify a maximum number of revisions, change ''false'' to an integer/number (''e.g.'', 3 or 5).

define('WP_POST_REVISIONS', 3);

=== Définir les Cookies de Domaine ===

The domain set in the cookies for WordPress can be specified for those with unusual domain setups. One reason is if [http://www.askapache.com/htaccess/apache-speed-subdomains.html subdomains are used to serve static content]. To prevent WordPress cookies from being sent with each request to static content on your subdomain you can set the cookie domain to your non-static domain only.

define('COOKIE_DOMAIN', 'www.askapache.com');

=== Activer le Multisite / Network Ability ===

WP_ALLOW_MULTISITE is a feature introduced in WordPress [[Version 3.0|Version 3.0]] to enable [[#Create_A_Network:_wp_options|multisite functionality]] previously achieved through '''WordPress MU'''. If this setting is absent from wp-config.php it defaults to false.

define('WP_ALLOW_MULTISITE', true);

=== Deboggage ===

The WP_DEBUG option, added in WordPress [[Version 2.3.1|Version 2.3.1]], controls the display of some errors and warnings. If this setting is absent from wp-config.php, then the value is assumed to be false.

{{Note|The true and false values in the example are not set in apostrophes (') because they are boolean values.}}

define('WP_DEBUG', true);

define('WP_DEBUG', false);

Additionally, if you are planning on modifying some of WordPress' built-in JavaScript or Cascading Style Sheets, you should add the following code to your config file:

define('SCRIPT_DEBUG', true);

Then all changes made to the scriptname.dev.js and filename.dev.css files in the wp-includes/js, wp-includes/css, wp-admin/js, and wp-admin/css directories will be reflected on your site.

[http://trac.wordpress.org/ticket/5473 In WordPress versions since 2.3.2, database errors are printed only if WP_DEBUG is set to true]. In earlier versions, database errors were always printed. (Database errors are handled by the wpdb class and are not affected by [http://www.php.net/errorfunc PHP's error settings].)

In WordPress version 2.5, setting WP_DEBUG to true also raises the [http://www.php.net/error-reporting error reporting level] to E_ALL and activates warnings when deprecated functions or files are used; otherwise, WordPress sets the error reporting level to E_ALL ^ E_NOTICE ^ E_USER_NOTICE.

=== Désactiver la Concaténation Javascript ===

To result in a faster administration area, all Javascript files are [http://en.wikipedia.org/wiki/Concatenation concatenated] into one URL. If Javascript is failing to work in your administration area, you can try disabling this feature:

define('CONCATENATE_SCRIPTS', false);

=== Configurer le Journal d'Errer ===

Because wp-config.php is loaded for every page view not loaded from a cache file, it is an excellent location to set php ini settings that control your php installation. This is useful if you don't have access to a php.ini file, or if you just want to change some settings on the fly.

If you turn on error logging, remember to delete the file afterwards, as it will often be in a publicly accessible location, where anyone could gain access to your log.

Here is an example that turns php error_logging on and logs them to a specific file. If WP_DEBUG is defined to true, the errors will also be saved to this file. Just place this above any ''require_once'' or ''include'' commands.

@ini_set('log_errors','On');

@ini_set('display_errors','Off');

@ini_set('error_log','/home/example.com/logs/php_error.log');

/* That's all, stop editing! Happy blogging. */

Another example of logging errors, as suggested by Mike Little on the [http://lists.automattic.com/pipermail/wp-hackers/2010-September/034830.html wp-hackers email list]:

A refined version from Mike Little on the [http://groups.google.com/group/manchester-wordpress-user-group/msg/dcab0836cabc7f76 Manchester WordPress User Group]:

=== Augmenter la Mémoire Allouée à PHP===

Also released with [[Version 2.5]], the '''WP_MEMORY_LIMIT''' option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as "Allowed memory size of xxxxxx bytes exhausted".

This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 40MB (code is at beginning of ''wp-settings.php''), so the setting in ''wp-config.php'' should reflect something higher than 40MB.

WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.

Please note, this setting may not work if your host does not allow for increasing the PHP memory limit--in that event, contact your host to increase the PHP memory limit. Also, note that many hosts set the PHP limit at 8MB.

Increase PHP Memory to 64MB

define('WP_MEMORY_LIMIT', '64M');

Increase PHP Memory to 96MB

define('WP_MEMORY_LIMIT', '96M');

=== Cache ===

The '''WP_CACHE''' setting, if true, includes the wp-content/advanced-cache.php script, when executing wp-settings.php.

define('WP_CACHE', true);

=== Custom User and Usermeta Tables ===

'''CUSTOM_USER_TABLE''' and '''CUSTOM_USER_META_TABLE''' are used to designated that the user and usermeta tables normally utilized by WordPress are not used, instead these values/tables are used to store your user information.

define('CUSTOM_USER_TABLE', $table_prefix.'my_users');

define('CUSTOM_USER_META_TABLE', $table_prefix.'my_usermeta');

Please note that permissions in the user_meta tables are stored with the table prefix of the site. So in the CUSTOM_USER_META_TABLE one must have entries for each site using that table.

At the very least for the administrator, to avoid the "you do not have permissions error" you should have:

prefix1_capabilities = a:1:{s:13:"administrator";b:1;}

and

prefix2_capabilities = a:1:{s:13:"administrator";b:1;}

etc

When using CUSTOM_USER_TABLE during initial setup it is easiest to: Setup your first instance of wordpress. The define statements of the wp-config.php on the first instance pointing to where you currently store user data wp_user by default, and then coping that working wp-config.php to your next instance which will only require you to change the $table_prefix = variable as previously stated. At this point the install will run as expected; however, do not use an e-mail address that is already in use by your original install. Use a different e-mail address. Once you have finished the setup process log in with the auto generated admin account and password. Then promote your normal account to the administrator level. Log out of admin. Log in as yourself. Delete the admin account and promote the other user accounts as is needed.

=== Language and Language Directory ===

'''WPLANG''' defines the name of the language translation (.mo) file. '''WP_LANG_DIR''' defines what directory the WPLANG .mo file resides. If WP_LANG_DIR is not defined WordPress looks first to wp-content/languages and then wp-includes/languages for the .mo defined by WPLANG file.

define('WPLANG', 'de_DE');

define('WP_LANG_DIR', $_SERVER['DOCUMENT_ROOT'].'wordpress/languages');

To find out the WPLANG language code, please refer to [[WordPress in Your Language]]. The code in parentheses after each language heading is what you need.

=== Save queries for analysis ===

The '''SAVEQUERIES''' definition saves the database queries to a array and that array can be displayed to help analyze those queries. The information saves each query, what function called it, and how long that query took to execute.

{{Note|This will have a performance impact on your site, so make sure to turn this off when you aren't debugging.}}

First, put this in wp-config.php:

define('SAVEQUERIES', true);

Then in the footer of your theme put this:

=== Override of default file permissions ===

The '''FS_CHMOD_DIR''' and '''FS_CHMOD_FILE''' define statements allow override of default file permissions. These two variables were developed in response to the problem of the core update function failing with hosts (e.g. some Italian hosts) running under suexec. If a host uses restrictive file permissions (e.g. 400) for all user files, and refuses to access files which have group or world permissions set, these definitions could solve the problem. Note that the ''''0755'''' is an octal value. Octal values must be prefixed with a 0 and are not delineated with single quotes ('). See Also: [[Changing File Permissions]]

define('FS_CHMOD_DIR', (0755 & ~ umask()));

define('FS_CHMOD_FILE', (0644 & ~ umask()));

Example to provide setgid:

define('FS_CHMOD_DIR', (02755 & ~umask()));

===WordPress Upgrade Constants===

'''You should define as few of the below constants''' needed to correct your update issues.

The most common causes of needing to define these are:

* Host running with a special installation setup involving Symlinks, You may need to define the path-related constants (FTP_BASE, FTP_CONTENT_DIR, and FTP_PLUGIN_DIR), Often defining simply the base will be enough.

* Certain PHP installations shiped with a PHP FTP Extension which is incompatible with certain FTP Servers, under these rare situations, you may need to define FTP_METHOD to 'ftpsockets'

The following are valid constants for WordPress updates:

*'''FS_METHOD''' forces the filesystem method. It should only be "direct", "ssh2", "ftpext", or "ftpsockets". Generally, You should only change this if you are experiencing update problems, If you change it, and it doesnt help '''change it back/remove it''', Under most circumstances, setting it to 'ftpsockets' will work if the automatically chosen method does not.

** '''(Primary Preference) "direct"''' forces it to use Direct File I/O requests from within PHP, this is fraught with opening up security issues on poorly configured hosts, This is chosen automatically when appropriate.

** '''(Secondary Preference) "ssh2"''' is to force the usage of the SSH PHP Extension if installed

** '''(3rd Preference) "ftpext"''' is to force the usage of the FTP PHP Extension for FTP Access, and finally

** '''(4th Preference) "ftpsockets"''' utilises the PHP Sockets Class for FTP Access.

*'''FTP_BASE''' is the full path to the "base"(ABSPATH) folder of the WordPress installation.

*'''FTP_CONTENT_DIR''' is the full path to the wp-content folder of the WordPress installation.

*'''FTP_PLUGIN_DIR''' is the full path to the plugins folder of the WordPress installation.

*'''FTP_PUBKEY''' is the full path to your SSH public key.

*'''FTP_PRIKEY''' is the full path to your SSH private key.

*'''FTP_USER''' is either user FTP or SSH username. Most likely these are the same, but use the appropriate one for the type of update you wish to do.

*'''FTP_PASS''' is the password for the username entered for '''FTP_USER'''. If you are using SSH public key authentication this can be omitted.

*'''FTP_HOST''' is the hostname:port combination for your SSH/FTP server. The default FTP port is 21 and the default SSH port is 22, These do not need to be mentioned.

*'''FTP_SSL''' TRUE for SSL-connection ''if supported by the underlying transport'', Not available on all servers. This is for "Secure FTP" not for SSH SFTP.

====Enabling SSH Upgrade Access====

There are two ways to upgrade using SSH2.

The first is to use the [http://wordpress.org/extend/plugins/ssh-sftp-updater-support/ SSH SFTP Updater Support plugin]. The second is to use the built-in SSH2 upgrader, which requires the pecl SSH2 extension be installed.

To install the pecl SSH2 extension you will need to issue a command similar to the following or talk to your web hosting provider to get this installed:

After installing the pecl ssh2 extension you will need to modify your php configuration to automatically load this extension.

pecl is provided by the pear package in most linux distributions. To install pecl in Redhat/Fedora/CentOS:

To install pecl in Debian/Ubuntu:

It is recommended to use a private key that is not pass-phrase protected. There have been numerous reports that pass phrase protected private keys do not work properly. If you decide to try a pass phrase protected private key you will need to enter the pass phrase for the private key as FTP_PASS, or entering it in the "Password" field in the presented credential field when installing updates.

If you're still not clear on how to use SSH for upgrading or installing WordPress/plugins, [http://www.firesidemedia.net/dev/wordpress-install-upgrade-ssh/ read through this tutorial].

===Alternative Cron===

Use this, for example, if scheduled posts are not getting published. According to [http://wordpress.org/support/topic/296236?replies=13#post-1175405 Otto's forum explanation], "this alternate method uses a redirection approach, which makes the users browser get a redirect when the cron needs to run, so that they come back to the site immediately while cron continues to run in the connection they just dropped. This method is a bit iffy sometimes, which is why it's not the default."

define('ALTERNATE_WP_CRON', true);

===Additional Defined Constants===

Here are additional constants that can be defined, but probably shouldn't be. The Cookie definitions are particularly useful if you have an unusual domain setup.

=== Empty Trash ===

Added with [[Version 2.9]], this constant controls the number of days before WordPress permanently deletes posts, pages, attachments, and comments, from the trash bin. The default is 30 days:

define('EMPTY_TRASH_DAYS', 30 ); // 30 days

To disable trash set the number of days to zero. Note that WordPress will not ask for confirmation when someone clicks on "Delete Permanently".

define('EMPTY_TRASH_DAYS', 0 ); // zero days

=== Automatic Database Optimizing ===

Added with [[Version 2.9]], there is automatic database optimization support, which you can enable by adding the following define to your wp-config.php file '''only when the feature is required'''

define('WP_ALLOW_REPAIR', true);

The script can be found at {$your_site}/wp-admin/maint/repair.php

'''Please Note:''' That this define '''enables''' the functionality, '''The user does not need to be logged in to access this functionality when this define is set.''' This is because its main intent is to repair a corrupted database, Users can often not login when the database is corrupt.

===Do not upgrade global tables===

A '''DO_NOT_UPGRADE_GLOBAL_TABLES''' define prevents dbDelta() and the upgrade functions from doing expensive queries against global tables.

Sites that have large global tables (particularly users and usermeta), as well as sites that share user tables with bbPress and other WordPress installs, can prevent the upgrade from changing those tables during upgrade by defining '''DO_NOT_UPGRADE_GLOBAL_TABLES'''. Since an ALTER, or an unbounded DELETE or UPDATE, can take a long time to complete, large sites usually want to avoid these being run as part of the upgrade so they can handle it themselves. Further, if installations are sharing user tables between multiple bbPress and WordPress installs it maybe necessary to want one site to be the upgrade master.

define('DO_NOT_UPGRADE_GLOBAL_TABLES', true);

=== View All Defined Constants ===

Php has a function that returns an array of all the currently defined constants with their values.

print_r(@get_defined_constants());

=== Disable the Plugin and Theme Editor ===

Occasionally you may wish to disable the plugin or theme editor to prevent overzealous users from being able to edit sensitive files and potentially crash the site. Disabling these also provides an additional layer of security if a hacker gains access to a well-privileged user account.

define('DISALLOW_FILE_EDIT',true);

'''Please note''': some plugins may have its functionality compromised by the use of current_user_can('edit_plugins') in their code. Plugins author should avoid checking for this capability, or at least check if this constant is set and display an appropriate error message. Users must be conscient that if a plugin is not working this may be the cause.

=== Disable Plugin and Theme Update and Installation ===

This will block users being able to use the plugin and theme installation/update functionality from the WordPress admin area. Setting this constant also disables the Plugin and Theme editor (i.e. you don't need to set DISALLOW_FILE_MODS and DISALLOW_FILE_EDIT, as on it's own DISALLOW_FILE_MODS will have the same effect).

define('DISALLOW_FILE_MODS',true);

== 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!

== See Also ==

*[[WordPress Backups]]

*[[Installing Multiple Blogs|Installing Multiple Blogs requires special wp-config.php]]

*[[Upgrading_WordPress_Extended|Troubleshooting Installations]]

*[[Administration_Over_SSL|Securing your Installation]]

[[Category:Getting Started]]

[[Category:Advanced Topics]]

[[Category:Installation]]

[[Category:UI Link]]

[[Category:Error handling]]

Show more