Codex

hr:Uređivanje wp-config.php

WordPress Hrvatski
Članci o WordPressu na hrvatskom jeziku.
U svaki prevedeni članak postavite {{Codex-hr}}.
WARNING: Prije uređivanja ove stranice.

Molimo nemojte uređivati i popunjavati ovu Codex stranicu sa postavkama za vaš server jer tako dajete svima pristup povjerljivim informacijama vaše web stranice, a instalacija neće biti ispravno postavljena. Hvala.

Contents

Kao dio WordPress instalacije, morate modificirati wp-config.php datoteku kako bi definirali WordPress konfiguracijske postavke potrebne za pristup vašoj MySQL bazi podataka.

Datoteka wp-config.php, ne postoji u preuzetoj kopiji WordPressa na vašem računalu; trebate ju sami napraviti. Datoteka wp-config-sample.php dostupna vam je kao primjer po kojem ćete raditi. Kreirajte wp-config.php prije uređivanja. Napredne postavke i primjeri su navedeni ispod.

Kako bi uredili wp-config.php datoteku za vašu instalaciju, trebate ove informacije:

Ime Baze podataka 
Ime Baze podataka koju koristi WordPress
Korisničko ime za Bazu podataka 
Korisničko ime za pristup bazi podataka
Lozinka Baze podataka 
Lozinka koju koristi korisničko ime za pristup bazi podataka
Host Baze podataka 
Ime hosta vašeg servera baze podataka

Ako je vaš pružatelj hosting usluga instalirao WordPress za vas, tražite ove informacije od njih. Ako sami upravljate vašim web serverom ili hosting računom, dobit ćete ove informacije kao rezultat kreiranja baze podataka i korisnika.

WARNING: Prije nego što modificirate wp-config-sample.php datoteku ili postojeću wp-config.php datoteku:

Sadržaj wp-config-sample.php datoteke napisan je u određenom redoslijedu. Redoslijed je važan. Ako već imate wp-config.php datoteku, promjena redoslijeda sadržaja datoteke može prouzrokovati pogreške na vašem blogu.


Konfiguracija Postavki Baze podataka

Važno: nikad nemojte koristiti uređivač teksta kao što je Microsoft Word za uređivanje WordPress datoteka!

Pronađite wp-config-sample.php datoteku u vašem WordPress direktoriju i otvorite ju u uređivaču teksta.

NOTE: Od Version 2.6, wp-config.php se može premjestiti u direktorij direktno iznad direktorija WordPress aplikacije.


Zadano wp-config-sample.php

Ovo je primjer zadane wp-config-sample.php datoteke. Ove vrijednosti su primjer kako bi prikazali što napraviti. Morate napraviti promijene na vašoj web stranici, NE ovdje. Ako ovdje napravite promijene koristeći gumb edit, one NEĆE funkcionirati i tako ćete javno prikazati povjerljive podatke baze podataka.

// ** MySQL postavke - Informacije o postavkama možete dobiti od vašeg web hosta ** //
/** Ime vaše baze podataka za WordPress */
define('DB_NAME', 'ovdje_upisite_ime_baze');

/** MySQL korisničko ime baze podataka */
define('DB_USER', 'ovdje_upisite_korisnicko_ime');

/** MySQL lozinka baze podataka */
define('DB_PASSWORD', 'ovdje_upisite_lozinku');

/** MySQL naziv hosta */
define('DB_HOST', 'localhost');
NOTE: Tekst unutar /* */ je komentar, namijenjen informiranju.
NOTE: Nemojte mijenjati detalje ovdje uređivanjem ove stranice, mjenjajte ih na vašem web serveru.


Unos Imena Baze podataka

Zamijenite ovdje_upisite_ime_baze, sa imenom vaše baze podataka, npr. MojaBazaPodataka.

define('DB_NAME', 'MojaBazaPodataka'); //Primjer imena MySQL baze podataka

Unos Korisnika Baze podataka

Zamijenite ovdje_upisite_korisnicko_ime, sa korisničkim imenom, npr. MojeKorisničkoIme.

define('DB_USER', 'MojeKorisničkoIme'); //Primjer MySQL korisničkog imena

Unos Lozinke Baze podataka

Zamijenite ovdje_upisite_lozinku, sa vašom lozinkom, npr. MojaLozinka.

define('DB_PASSWORD', 'MojaLozinka'); //Primjer MySQL lozinke

Unos Hosta Baze podataka

Zamijenite localhost, sa imenom hosta vaše baze podataka,npr. HostMojeBazePodataka.

define('DB_HOST', 'HostMojeBazePodataka'); //Primjer hosta MySQL baze podataka
NOTE: Postoji dobra šansa da NEĆETE morati mijenjati ovu stavku. Ako niste sigurni pokušajte instalirati sa zadanom stavkom 'localhost' i provjerite je li radi. Ako instalacije ne uspije, kontaktirajte vašeg pružatelja web host usluga.


Moguće DB_HOST vrijednosti

Različite hosting kompanije koriste različite mrežne postavke za svoje MySQL baze podataka. Ako je vaša hosting kompanija navedena ispod u lijevom stupcu, vrijednosti u desnom stupcu trebale bi odgovarati pravim vrijednostima za DB_HOST. Kontaktirajte svoju tehničku podršku i/ili pretražite dokumentaciju vaše hosting kompanije.

Hosting Kompanija Moguće DB_HOST vrijednosti
1and1 db12345678
AN Hosting localhost
A Small Orange localhost
BlueHost localhost
DreamHost mysql.example.com
GoDaddy Otvorite MySQL bazu podataka kako bi saznali ime servera.
HostGator localhost
HostICan localhost
ICDSoft localhost:/tmp/mysql5.sock
IPower username.ipowermysql.com
LaughingSquid localhost
MediaTemple GridServer internal-db.s44441.gridserver.com
MediaTemple (dv) localhost
MegnaHost localhost
NearlyFreeSpeech.Net username.db
one.com localhost
pair Networks dbnnnx.pair.com
Rackspace Cloud mysql50-01.wc1.dfw1.stabletransit.com
Yahoo mysql
Hosts with cPanel localhost
Hosts with Plesk localhost
Hosts with DirectAdmin localhost
Tophost.it sql.your-domain-name.it



Alternativni MySQL Port

Ako vaš host koristi alternativni broj porta za vašu bazu podataka morati ćete promijeniti DB_HOST vrijednost u wp-config.php datoteci kako bi ispravno funkcioniralo.

Za localhost

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

Drugo

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

Zamijenite 3307 sa bilo kojim brojem koji vam vaš host dostavi.

Kodna stranica Baze podataka

Od WordPress Version 2.2, DB_CHARSET je omogućen za određivanje kodne stranice baze podataka (npr. tis620 za TIS620 Thai) koje se koristi prilikom definiranja tablica MySQL baze podataka.

Zadana vrijednost utf8 (Unicode UTF-8) je skoro uvijek najbolja opcija. UTF-8 podržava sve jezike, tako da je obično najbolje ostaviti DB_CHARSET postavljeno na utf8 i umjesto toga koristiti DB_COLLATE vrijednost za vaš jezik.

Ovaj primjer pokazuje utf8 koji je zadana WordPress vrijednost:

define('DB_CHARSET', 'utf8');
WARNING: Oni koji prave nove instalacije

Obično nema razloga mijenjati zadanu vrijednost DB_CHARSET. Ako vaš blog treba drugačiju kodnu stranicu, molimo pročitajte Character Sets and Collations MySQL Supports za ispravne DB_CHARSET vrijednosti.

WARNING: Oni koji rade nadogradnje (pogotovo blogovi koji su postojali prije inačice 2.2)

Ako stavke DB_CHARSET i DB_COLLATE ne postoje u vašoj wp-config.php datoteci, NEMOJTE dodavati te definicije u vašu wp-config.php datoteku osim ako pročitate i razumijete Converting Database Character Sets. Dodavanje DB_CHARSET i DB_COLLATE wp-config.php datoteci postojećeg bloga, može prouzrokovati velike probleme.

Sortiranje Baze podataka

Od WordPress Version 2.2, DB_COLLATE je omogućen kako bi dopustio određivanje sortiranja baze podataka (npr. način sortiranja uznačivanja znakova). U većini slučajeva, ova stavka bi trebala biti prazna (null) tako da sortiranje baze podataka automatski dodijeli MySQL, bazirano na uznačivanju znakova baze podataka navedenom u DB_CHARSET. Postavite DB_COLLATE na jednu od UTF-8 vrijednosti navedenih u UTF-8 character sets za većinu Zapadnoeuropskih jezika.

Zadana vrijednost WordPressa za DB_COLLATE:

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');
WARNING: Oni koji prave nove instalacije

Obično nema razloga mijenjati zadanu vrijednost DB_CHARSET. Ostavljanje ove vrijednosti praznom (null) MySQL će automatski dodijeliti sortiranje prilikom kreiranja tablica baze podataka.

WARNING: Oni koji rade nadogradnje (pogotovo blogovi koji su postojali prije inačice 2.2)

Ako stavke DB_CHARSET i DB_COLLATE ne postoje u vašoj wp-config.php datoteci, NEMOJTE dodavati te definicije u vašu wp-config.php datoteku osim ako pročitate i razumijete Converting Database Character Sets.Možda ćete morati napraviti nadigradnju WordPressa.


Sigurnosni Ključevi

U WordPressu Version 2.6, dodana su tri (3) sigurnosna ključa, AUTH_KEY, SECURE_AUTH_KEY i LOGGED_IN_KEY, kako bi poboljšali enkripciju pohranjenih podataka u korisničke kolačiće (cookies). (Oni su kolektivno zamijenili jedini ključ koji je uveden u Version 2.5.) U Version 2.7 dodan je i četvrti ključ, NONCE_KEY. Kada su dodani svi ključevi, dodani su im i pripadajući SALT-ovi: AUTH_SALT, SECURE_AUTH_SALT, LOGGED_IN_SALT i NONCE_SALT.

Vi ne morate zapamtiti ove ključeve, samo ih napravite dugačkim, raznovrsnim i kompliciranim -- ili još bolje upotrijebite online generator. Možete ih promijeniti bili kad kako bi postojeće kolačiće učinili ne važećima. Ovo znači da će se svi korisnici morati ponovno prijaviti.

Primjer (nemojte koristiti ove ključeve!):

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<S(O:+f#WM+q|npJ-+P;RDKT:~jrmgj#/-,[hOBk!ry^');
define('NONCE_KEY',        'FIsAsXJKL5ZlQo)iD-pt??eUbdc{_Cn<4!d~yqz))&B D?AwK%)+)F2aNwI|siOe');
define('AUTH_SALT',        '7T-!^i!0,w)L#JK@pc2{8XE[DenYI^BVf{L:jvF,hf}zBf883td6D;Vcy8,S)-&G');
define('SECURE_AUTH_SALT', 'I6`V|mDZq21-J|ihb u^q0F }F_NUcy`l,=obGtq*p#Ybe4a31R,r=|n#=]@]c #');
define('LOGGED_IN_SALT',   'w<$4c$Hmd%/*]`Oom>(hdXW|0M=X={we6;Mpvtg+V.o<$|#_}qG(GaVDEsn,~*4i');
define('NONCE_SALT',       'a|#h{c5|P &xWs4IZ20c2&%4!c(/uG}W:mAvy<I44`jAbup]t=]V<`}.py(wTP%%');

Tajni ključ će učiniti vašu web stranicu težom za hakirati i pristupiti i težom za srušiti dodajući nasumične elemente u lozinku.

Pojednostavljeno, tajni ključ je lozinka sa elementima koji ju čine težom za generirat dovoljno opcija za probijanje kroz vaše sigurnosne barijere. Lozinke poput "lozinka" ili "test" su jednostavne i lake za probiti. Za nasumičnu, nepredvidivu lozinku kao što je "88a7da62429ba6ad3cb3c76a09641fc" potrebne su godine kako bi se otkrila njena kombinacija. SALT se koristi za daljnje povećanje sigurnosti generiranog rezultata.

Četiri ključa su obavezna za pojačanu sigurnost. Četiri SALT-a su preporučena, ali nisu obavezna, jer će ih WordPress generirati za vas ako ih nema. Oni su već uključeni u wp-config.php datoteku.

Za više informacija o tehničkoj pozadini i detaljnom pregledu sigurnosnih ključeva i sigurnosnih lozinki pročitajte:

Napredne Opcije

Sljedeća sekcija može sadržavati napredne / nepodržane informacije, stoga molimo pravite redovite sigurnosne kopije i upoznajte se sa procesom vraćanja istih prije eksperimentiranja na ispravnoj instalaciji.

table_prefix

$table_prefix je vrijednost smještena na početku tablica vaše baze podataka. Promijenite ovu vrijednost ako želite koristiti nešto drugo od wp_ za prefiks vaše baze podataka. Obično ovo je promijenjeno ako instalirate višestruke WordPress blogove u istoj bazi podataka.

// Možete imati višestruke instalacije u jednoj bazi podataka ako svakoj pridodate jedinstveni prefiks $table_prefix  = 'r235_';   //Dopušteni su samo slova, brojke i donje crtice ( _ )!

Druga blog instalacija koja koristi istu bazu podataka može se jednostavno postići koristeći različiti prefiks od drugih instalacija.

$table_prefix  = 'y77_';   // Dopušteni su samo slova, brojke i donje crtice ( _ )!

WordPress adresa (URL)

WP_SITEURL, definirano od WordPress Version 2.2, omogućuje definiranje WordPress adrese (URL). Vrijednost koja je definirana je adresa gdje se nalaze datoteke jezgre WordPressa. U adresi bi se trebao nalaziti i http://. Nemojte stavljati znak "/" na kraju adrese. Postavljanjem ove vrijednosti u wp-config.php zaobilazi se vrijednost wp_options tablice za siteurl i onesposobljava polje, WordPress adresa(URL) u Administration > Settings > General zaslonu.

NOTE: Ovime se neće promijeniti vrijednost u bazi podataka, i url će se vratiti staroj vrijednosti ako se ovaj red ukloni iz wp-config.php. Upotrijebite RELOCATE konstantu kako bi promijenili siteurl vrijednost u bazi podataka.

Ako je WordPress instaliran i driktorij nazvan "WordPress" za domenu primjer.com, ovako definirajte WP_SITEURL:

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

Dinamički postavite WP_SITEURL bazirano na $_SERVER['HTTP_HOST']

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/putanja/do/wordpressp');
NOTE: Sigurnija alternativa za neke instalacije bila bi korištenje SERVER_NAME generiranog od strane servera, umjesto php/korisnički-generiranog HTTP_HOST koji je php kreirao dinamički bazirano na vrijednosti HTTP HOST Header u zahtjevu, stoga možda i dopuštajući ranjivost uključivanja datoteka (file inclusion vulnerabilities). SERVER_NAME je postavila konfiguracija servera i statično je.

Dinamički postavite WP_SITEURL bazirano na $_SERVER['SERVER_NAME']

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/putanja/do/wordpressp');

Blog adresa (URL)

WP_HOME je još jedna wp-config.php opcija dodana u WordPress Version 2.2. Slično WP_SITEURL, WP_HOME zaobilazi wp_options tablicu vrijednost za home ali ju ne mijenja za stalno. home je adresa koju želite da ljudi upišu u svoje preglednike kako bi došli na vaš WordPress blog. Trebalo bi uključivati http:// dio i ne bi trebalo sadržavati "/" na kraju.

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

Ako koristiti tehniku opisanu u Giving WordPress Its Own Directory onda pratite primjer napisan ispod. Zapamtite, morati ćete smjestiti index.php u vaš web korijenski direktorij ako koristite ovakve postavke.

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

Dinamično postavljen WP_HOME baziran na $_SERVER['HTTP_HOST']

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

Premještanje wp-content

Od Version 2.6, možete premjestiti wp-content direktorij, koji sadrži vaše teme, dodatke i prenesene datoteke, izvan direktorija WordPress aplikacije.

Postavite WP_CONTENT_DIR u punoj lokalnoj putanji ovog direktorija (bez kose crte na kraju), npr.

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

Postavite WP_CONTENT_URL u punom URI ovog direktorija (bez kose crte na kraju), npr.

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

Opcionalno
Postavite WP_PLUGIN_DIR u punoj lokalnoj putanji ovog direktorija (bez kose crte na kraju), npr.

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

Postavite WP_PLUGIN_URL u punom URI ovog direktorija (bez kose crte na kraju), npr.

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

Ako imate problema sa kompaitiblnošću dodataka Postavite PLUGINDIR u punoj lokalnoj putanji ovog direktorija (bez kose crte na kraju), npr.

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

Modificirajte Interval Automatskog snimanja

Kada uređujete post WordPress koristi Ajax za automatsko snimanje revizija posta kojeg uređujete. Možda ćete poželjeti povećati onu postavku za veće vremenske razmake između snimanja, ili smanjiti postavku kako ne bi izgubili i najmanju promjenu. Zadana postavka je 60 sekundi.

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

Post Revizije

WordPress, po zadanom, snimati će kopije svakog uređivanja posta ili stranice, omogućavajući mogućnost vraćanja na prethodnu inačicu tog posta ili stranice. Snimanje revizija može biti onemogućeno, ili se može odrediti maksimalni broj revizija po postu ili stranici.

Onemogućite Post Revizije

Ako ne postavite ovu vrijednost, WordPress zadana vrijednost WP_POST_REVISIONS postavljena na true (omogući post revizije). Ako želite onemogućiti ovu super mogućnost post revizija, upotrijebite ovu postavku:

define('WP_POST_REVISIONS', false );

Odredite broj Post Revizija

Ako želite odrediti maksimalni broj post revizija, promijenite false u neki broj(npr., 3 ili 5).

define('WP_POST_REVISIONS', 3);

Postavite Kolačić Domenu

Domena postavljena u kolačićima za wordPress može biti navedena za one sa neuobičajenim postavkama domena. Jedna od razloga je ako se poddomene koriste za posluživanje statičnog sadržaja. Kako bi spriječili da se WordPress kolačići šalju sa svakim zahtjevom za statičnim sadržajem na vašoj poddomeni možete postaviti kolačić domenu samo na vašu nestatičnu domenu.

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

Omogućite Multisite / Mrežnu mogućnost

WP_ALLOW_MULTISITE je mogućnost uvedena u WordPress Inačici 3.0 kako bi omogućili multisite funkcionalnost prethodno dostupnu kroz WordPress MU. Ako ova postavka nije prisutna u wp-config.php multisite funkcionalnost neće biti uključena.

define('WP_ALLOW_MULTISITE', true);

Ispravljanje pogrešaka

WP_DEBUG opcija dodan u WordPress Inačici 2.3.1, kontrolira prikazivanje nekih pograšaka i upozorenja. Ako ove postavke nema u wp-config.php, onda se za vrijednost pretpostavlja var>false</var>.

NOTE: Vrijednosti true i false u primjeru nisu postavljene u apostrofima (') jer su to boolean vrijednosti.
define('WP_DEBUG', true);
define('WP_DEBUG', false);

Uz to, ako planirate modificirati neke od WordPress ugrađenih JavaScript, trebali bi omogućiti sljedeću opciju:

define('SCRIPT_DEBUG', true);

Ovo će vam omogućiti da uređujete scriptname.dev.js datoteke u wp-includes/js i wp-admin/js direktorijima.

u WordPressu od inačice 2.3.2, pogreške baze podataka se prikazuju samo ako je WP_DEBUG postavljen na true. U ranijim inačicama, pogreške baze podataka su uvijek prikazivane. (Pogreškama baze podataka rukkovodi wpdb klasa, i na njih ne utječe postavke pogrešaka PHP-a.)

U WordPress inačici 2.5, postavljanje WP_DEBUG na true također je pokretalo nivo prijavljivanja pogrešaka na E_ALL i aktivira upozorenja kada se koriste zastarjele funkcije ili datoteke; inače WordPress postavlja nivo prijavljivanja pogrešaka na E_ALL ^ E_NOTICE ^ E_USER_NOTICE.

Disable Javascript Concatenation

To result in a faster administration area, all Javascript files are concatenated into one URL. If Javascript is failing to work in your administration area, you can try disabling this feature:

define('CONCATENATE_SCRIPTS', false);

Configure Error Log

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.

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 wp-hackers email list:

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content (if Apache does not have write permission, you may need to create
 * the file first and set the appropriate permissions (i.e. use 666) ) 
 */
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

A recent suggestion from Mike Little on the Manchester WordPress User Group:

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content only when WP_DEBUG is true
 */

define('WP_DEBUG', true); // false
if (WP_DEBUG) {
  define('WP_DEBUG_LOG', true);
  define('WP_DEBUG_DISPLAY', false);
  @ini_set('display_errors',0);
}

Increasing memory allocated to 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 32MB (code is at beginning of wp-settings.php), so the setting in wp-config.php should reflect something higher than 32MB.

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

Jezik i Jezični direktorij

WPLANG definira naziv prevedne jezične (.mo) datoteke. WP_LANG_DIR definira u kojem se direktoriju nalazi WPLANG .mo datoteka. Ako WP_LANG_DIR nije definiran WordPress prvo traži u wp-content/languages a zatim u wp-includes/languages .mo datoteke definirane od strane WPLANG datoteke.

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

Kako bi saznali WPLANG jezični kod, molimo referirajte se na WordPress in Your Language. Kod se nalazi u okruglim zagradama iza svakog naziva jezika.

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:

<?php
if (current_user_can('administrator')){
    global $wpdb;
    echo "<pre>";
    print_r($wpdb->queries);
    echo "</pre>";
}
?>

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.
define('FS_METHOD', 'ftpext');
define('FTP_BASE', '/path/to/wordpress/');
define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');
define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');
define('FTP_USER', 'username');
define('FTP_PASS', 'password');
define('FTP_HOST', 'ftp.example.org');
define('FTP_SSL', false);

Enabling SSH Upgrade Access

To enable SSH2 as an upgrade option you will need to install the pecl SSH2 extension. To install this library you will need to issue a command similar to the following or talk to your web hosting provider to get this installed:

pecl install ssh2

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:

yum -y install php-pear

To install pecl in Debian/Ubuntu:

apt-get install php-pear

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, read through this tutorial.

Alternative Cron

Use this, for example, if scheduled posts are not getting published. According to 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.

define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );
define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );
define('ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
define('PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
define('TEMPLATEPATH', get_template_directory());
define('STYLESHEETPATH', get_stylesheet_directory());
define('DISABLE_WP_CRON', true);

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);

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