Ticker

6/recent/ticker-posts

Header Ads Widget

Responsive Advertisement

Uploading wp-config.php on WordPress

Uploading wp-config.php on WordPress

If you prefer to edit configuration files rather than rely on the web-based installer, or if you need to use
some of the extra configuration options (a default language other than English, for example), you can
create the configuration file by hand. Download the installation package from wordpress.org. Unzip it
and rename wp-config-sample.php to wp-config.php. Open wp-config.php in a text editor. The sample
file contains comments instructing you how to fill in the necessary values. See Listing 2-1 for a
completed example. You should fill in:

  • The name of your database
  • Your database user name
  • Your database password
  • The database host name
     If you were given a port number as well as a host name, you should include the port in the host
definition, separated by a colon, like so: define(‘DB_HOST’, ‘localhost:3303’);
     If your WordPress database will be shared with other installations or applications, you might need
to change the default table prefix from ‘wp_’ to something less generic. For example, if your web hosting plan allows you just one MySQL database, but you need to create two independent WordPress sites on that account, you’ll need to choose another table prefix for one or both of those installations.
    There are many translations available for WordPress. You can change the language setting by
entering a language code in the WPLANG line. However, you’ll also need to download the corresponding
language file. For a complete list of available languages and instructions on installing the files, see
http://codex.wordpress.org/Installing_WordPress_in_Your_Language.,

Uploading wp-config.php on WordPress - The completed wp-config.php

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

/** MySQL database username */
define('DB_USER', ‘my_wp_db_user’);

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

/** 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.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/
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', '%DX<0oKh8Docq=$l6k&+Fy2`J-@qELUUr(U-2BvjS|xu}n=bf;9aPkt5&.FDP@,y');
define('SECURE_AUTH_KEY', '[3Y7|1jK8?iUyK_VSr5W+!xl_O0v8vG|V1+[^E4I+Ealw@<T@S?:AWK?3m#zT)bD');
define('LOGGED_IN_KEY', '4q-TS=Y+}hgM9j(bw.[C!j1!zcj{3M8:u@:STF(N R.7E6u1]Ouci FYr.$0~FJK');
define('NONCE_KEY', 'UdXil[`Wff0[|+Hh*+RR&{z4l4U!T_HS/8oH{SpKe#m!Z6;I2Y,% @mW4ucSfuIQ');
/**#@-*/

/**
* 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.mo to wp-content/languages and set WPLANG to 'de' to enable German
* language support.
*/
define ('WPLANG', '');
/* That's all, stop editing! Happy blogging. */

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

Uploading wp-config.php on WordPress - Troubleshooting:

On most web hosts, PHP errors are logged rather than printed to the screen. This is good security; it
prevents you from accidentally exposing your database password or other sensitive information if you
mess up your code. However, this feature also prevents you from seeing what’s gone wrong if there was a problem during your installation. Instead of a login screen, you’ll just see a blank white page.

If you know where your PHP error log is, you can check it to see what the problem was. If you don’t
know where the log is, you can check your web host’s documentation to find out, or you can simply turn on the error display until you resolve the problem. WordPress will not display your database connection information even if there is an error.
  To display errors, add the WP_DEBUG constant to your wp-config.php file, as shown in Listing 2-2.
You can put it anywhere, but I like to keep it at the top.

Debugging with wp-config.php (partial)

define('WP_DEBUG', true);
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'my_wp_db');
/** MySQL database username */
define('DB_USER', ‘my_wp_db_user’);

Visit your site again, and you should see the problem. Ignore any warnings and notices, and look for
fatal errors. Is there an unknown function? Look for a missing file, or simply re-upload the entire
WordPress package. Figure 2-9 shows the error messages you would see if one of the files from wpincludes were missing–in this case, capabilities.php. The first message, a warning, could be safely
ignored, but in this case it provides us with a clue as to why the second error occurred. The fatal error is the showstopper. Resolve that problem, and WordPress should work correctly.

When you've solved the problem, switch the value of WP_DEBUG to false, as shown in down 

Turn off debugging in wp-config.php (partial)

define('WP_DEBUG', false);

Error messages




Post a Comment

0 Comments