$config API variable / Config class

Holds ProcessWire configuration settings as defined in /wire/config.php and /site/config.php.

For more detailed descriptions of these $config properties, including default values, see the /wire/config.php file.


Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Config class also inherits all the methods and properties of: WireData and Wire.

Show $var?             Show args?        

Common

NameReturnSummary 
$config->js()
array mixed null thisSet or retrieve a config value to be shared with javascript 
$config->path(string $for)
null stringGet disk path for requested resource or module 
$config->url($for)
string nullGet URL for requested resource or module 

Date time

NameReturnSummary 
$config->dateFormat string Default system date format, preferably in sortable string format. Default is 'Y-m-d H:i:s'  
$config->timezone string Current timezone using PHP timeline options: http://php.net/manual/en/timezones.php  

Tools

NameReturnSummary 
$config->installedAfter($date)
boolWas this ProcessWire installation installed after a particular date? 
$config->installedBefore($date)
boolWas this ProcessWire installation installed before a particular date? 
$config->phpVersion($minVersion)
boolReturn true if current PHP version is equal to or newer than the given version 
$config->version()
bool stringCheck if current ProcessWire version is equal to or newer than given version, or return current version
Can also be used as property: $config->version
 

Runtime

NameReturnSummary 
$config->ajax bool If the current request is an ajax (asynchronous javascript) request, this is set to true.  
$config->cli bool This is automatically set to TRUE when PW is booted as a command line (non HTTP) script.  
$config->https bool If the current request is an HTTPS request, this is set to true.  
$config->internal bool This is automatically set to FALSE when PW is externally bootstrapped.  
$config->modal bool int If the current request is in a modal window, this is set to a positive number. False if not.  
$config->pagerHeadTags string null Populated at runtime to contain `<link rel=prev|next />` tags for document head, after pagination has been rendered by MarkupPagerNav module.  
$config->paths Paths All of what can be accessed from $config->urls can also be accessed from $config->paths, with one important difference: the returned value is the full disk path on the server. There are also a few items in $config->paths that aren't in $config->urls. All entries in $config->paths always end with a trailing slash.  
$config->scripts FilenameArray Array used by ProcessWire admin to keep track of what javascript files its template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites.  
$config->styles FilenameArray Array used by ProcessWire admin to keep track of what stylesheet files its template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites.  
$config->systemVersion int System version, used by SystemUpdater to determine when updates must be applied.  
$config->urls Paths Items from $config->urls reflect the http path one would use to load a given location in the web browser. URLs retrieved from $config->urls always end with a trailing slash. This is the same as the $urls API variable.  
$config->versionName string This is automatically populated with the current PW version name (i.e. 2.5.0 dev)  

HTTP and input

NameReturnSummary 
$config->httpHost string Current HTTP host name.  
$config->httpHosts array HTTP hosts For added security, specify the host names ProcessWire should recognize.  
$config->noHTTPS bool string array When boolean true, pages requiring HTTPS will not enforce it (useful for dev environments). May also specify hostname (string) or hostnames (array) to disable HTTPS for.  
$config->protectCSRF bool Enables CSRF (cross site request forgery) protection on all PW forms, recommended for security.  
$config->wireInputLazy bool Specify true for $input API var to load input data in a lazy fashion and potentially use less memory. Default is false.  
$config->wireInputOrder string Order that variables with the $input API var are handled when you access $input->var.  

System

NameReturnSummary 
$config->adminEmail string Email address to send fatal error notifications to.  
$config->advanced bool Special mode for ProcessWire system development. Not recommended for regular site development or production use.  
$config->allowExceptions bool Allow Exceptions to propagate? (default=false, specify true only if you implement your own exception handler)  
$config->debug bool int Special mode for use when debugging or developing a site. Recommended TRUE when site is in development and FALSE when not. Or set to Config::debugVerbose for verbose debug mode.  
$config->debugIf string Enable debug mode if condition is met  
$config->debugTools array Tools, and their order, to show in debug mode (admin)  
$config->demo bool Special mode for demonstration use that causes POST requests to be disabled. Applies to core, but may not be safe with 3rd party modules.  
$config->fatalErrorHTML string HTML used for fatal error messages in HTTP mode.  
$config->installed int Timestamp of when this PW was installed, set automatically by the installer for future compatibility detection.  
$config->lazyPageChunkSize int Chunk size for for $pages->findMany() calls.  
$config->preloadCacheNames array Cache names to preload at beginning of request  
$config->systemVersion int System version, used by SystemUpdater to determine when updates must be applied.  
$config->useFunctionsAPI bool Allow most API variables to be accessed as functions? (see /wire/core/FunctionsAPI.php)  
$config->useMarkupRegions bool Enable support for front-end markup regions?  
$config->usePoweredBy bool Use the x-powered-by header? Set to false to disable.  

URLs

NameReturnSummary 
$config->maxPageNum int Maximum number of recognized paginations  
$config->maxUrlDepth int Maximum URL/path slashes (depth) for request URLs. (Min=10, Max=60)  
$config->maxUrlSegmentLength int Maximum length of any individual URL segment (default=128).  
$config->maxUrlSegments int Maximum number of extra stacked URL segments allowed in a page's URL (including page numbers)  
$config->pageNameCharset string Character set for page names, must be 'ascii' (default, lowercase) or 'UTF8' (uppercase).  
$config->pageNameUntitled string Name to use for untitled pages (default="untitled").  
$config->pageNameWhitelist string Whitelist of characters allowed in UTF8 page names.  
$config->pageNumUrlPrefix string Prefix used for pagination URLs. Default is "page", resulting in "/page1", "/page2", etc.  
$config->pageNumUrlPrefixes array Multiple prefixes that may be used for detecting pagination (internal use, for multi-language)  
$config->urls Paths Items from $config->urls reflect the http path one would use to load a given location in the web browser. URLs retrieved from $config->urls always end with a trailing slash. This is the same as the $urls API variable.  

Template files

NameReturnSummary 
$config->appendTemplateFile string PHP file in /site/templates/ that will be loaded after each page's template file (default=none)  
$config->contentTypes array Array of extensions and the associated MIME type for each (for template file output).  
$config->ignoreTemplateFileRegex string Regular expression to ignore template files  
$config->prependTemplateFile string PHP file in /site/templates/ that will be loaded before each page's template file (default=none)  
$config->templateCompile bool Allow use of compiled templates?  
$config->templateExtension string Default is 'php'  

Images

NameReturnSummary 
$config->adminThumbOptions array Admin thumbnail image options  
$config->imageSizerOptions array Options to set image sizing defaults. Please see the /wire/config.php file for all options and defaults.  
$config->webpOptions array Options for webp images. Please see /wire/config.php for all options.  

Files

NameReturnSummary 
$config->chmodDir string Octal string permissions assigned to directories created by ProcessWire  
$config->chmodFile string Octal string permissions assigned to files created by ProcessWire  
$config->chmodWarn bool Set to false to suppress warnings about 0666/0777 file permissions that are potentially too loose  
$config->fileCompilerOptions array Array of options for FileCompiler class. See /wire/config.php for details and defaults.  
$config->fileContentTypes array Array of extensions and the associated MIME type for each (for file output). See /wire/config.php for details and defaults.  
$config->pagefileExtendedPaths bool Use extended file mapping?  
$config->pagefileSecure bool When used, files in /site/assets/files/ will be protected with the same access as the page. Routines files through a passthrough script.  
$config->pagefileSecurePathPrefix string One or more characters prefixed to the pathname of protected file dirs. This should be some prefix that the .htaccess file knows to block requests for.  
$config->uploadBadExtensions string Space separated list of file extensions that are always disallowed from uploads.  
$config->uploadTmpDir string Optionally override PHP's upload_tmp_dir with your own. Should include a trailing slash.  

Session

NameReturnSummary 
$config->loginDisabledRoles array Array of role name(s) or ID(s) of roles where login is disallowed.  
$config->sessionAllow bool callable Are sessions allowed? Typically boolean true, unless provided a callable function that returns boolean. See /wire/config.php for an example.  
$config->sessionChallenge bool Should login sessions have a challenge key? (for extra security, recommended)  
$config->sessionCookieDomain null string Domain to use for sessions, which enables a session to work across subdomains, or NULL to disable (default/recommended).  
$config->sessionCookieSecure bool int Use secure cookies when on HTTPS? When enabled, separate sessions will be maintained for HTTP vs. HTTPS. Good for security but tradeoff is login session may be lost when switching (default=1 or true).  
$config->sessionExpireSeconds int How many seconds of inactivity before session expires?  
$config->sessionFingerprint bool Should login sessions be tied to IP and user agent? 0 or false: Fingerprint off. 1 or true: Fingerprint on with default/recommended setting (currently 10). 2: Fingerprint only the remote IP. 4: Fingerprint only the forwarded/client IP (can be spoofed). 8: Fingerprint only the useragent. 10: Fingerprint the remote IP and useragent (default). 12: Fingerprint the forwarded/client IP and useragent. 14: Fingerprint the remote IP, forwarded/client IP and useragent (all).  
$config->sessionForceIP string Force the client IP address returned by $session->getIP() to be this rather than auto-detect (useful with load balancer). Use for setting value only.  
$config->sessionHistory int Number of session entries to keep (default=0, which means off).  
$config->sessionName string Default session name to use (default='wire')  
$config->sessionNameSecure string Session name when on HTTPS. Used when the sessionCookieSecure option is enabled (default). When blank (default), it will assume sessionName + 's'.  
$config->userAuthHashType string Default is 'sha1' - used only if Blowfish is not supported by the system.  
$config->userAuthSalt string Salt generated at install time to be used as a secondary/non-database salt for the password system.  

Database

NameReturnSummary 
$config->dbCache bool Whether to allow MySQL query caching.  
$config->dbCharset string Default is 'utf8' but 'utf8mb4' is also supported.  
$config->dbEngine string Database engine (MyISAM or InnoDB)  
$config->dbHost string Database host  
$config->dbInitCommand string Database init command, for PDO::MYSQL_ATTR_INIT_COMMAND. Note placeholder {charset} gets replaced with $config->dbCharset.  
$config->dbLowercaseTables bool Force any created field_* tables to be lowercase.  
$config->dbName string Database name  
$config->dbOptions array Any additional driver options to pass as $options argument to "new PDO(...)".  
$config->dbPass string Database password  
$config->dbPath string MySQL database exec path (Path to mysqldump)  
$config->dbPort string Database port (default=3306)  
$config->dbQueryLogMax int Maximum number of queries WireDatabasePDO will log in memory, when debug mode is enabled (default=1000).  
$config->dbSocket string Optional DB socket config for sites that need it.  
$config->dbSqlModes array Set or adjust SQL mode per MySQL version, where array keys are MySQL version and values are SQL mode command(s).  
$config->dbStripMB4 bool When dbEngine is not utf8mb4 and this is true, we will attempt to remove 4-byte characters (like emoji) from inserts when possible. Note that this adds some overhead.  
$config->dbUser string Database user  

Modules

NameReturnSummary 
$config->markupQA array Optional settings for MarkupQA class used by FieldtypeTextarea module.  
$config->moduleCompile bool Allow use of compiled modules?  
$config->moduleServiceKey string API key for modules web service  
$config->moduleServiceURL string URL where the modules web service can be accessed  
$config->pageAdd array Settings specific to Page adding.  
$config->pageEdit array Settings specific to Page editors.  
$config->pageList array Settings specific to Page lists.  
$config->substituteModules array Associative array with names of substitute modules for when requested module doesn't exist  
$config->wireMail array Default WireMail module settings.  

Admin

NameReturnSummary 
$config->defaultAdminTheme string Default admin theme: AdminThemeDefault or AdminThemeReno  
$config->logIP bool Include IP address in logs, when applicable?  
$config->logs array Additional core logs to keep  
$config->modals array Settings for modal windows  

System IDs

NameReturnSummary 
$config->adminRootPageID int Page ID of admin root page  
$config->externalPageID int Page ID of page assigned to $page API variable when externally bootstrapped  
$config->guestUserPageID int Page ID of the guest (default/not-logged-in) user.  
$config->guestUserRolePageID int Page ID of the guest user role (inherited by all users, not just guest).  
$config->http404PageID int Page ID of the 404 “page not found” page.  
$config->loginPageID int Page ID of the admin login page.  
$config->permissionTemplateID int Template ID of the permission template.  
$config->permissionsPageID int Page ID of the page having permissions as children.  
$config->preloadPageIDs array Page IDs of pages that will always be preloaded at beginning of request  
$config->roleTemplateID int Template ID of the role template.  
$config->rolesPageID int Page ID of the page having roles as children.  
$config->rootPageID int Page ID of homepage (usually 1)  
$config->superUserPageID int Page ID of the original superuser (created during installation).  
$config->superUserRolePageID int Page ID of the superuser role.  
$config->trashPageID int Page ID of the trash page.  
$config->userTemplateID int Template ID of the user template.  
$config->userTemplateIDs array Array of template IDs when multiple allowed for users.  
$config->usersPageID int Page ID of the page having users as children.  
$config->usersPageIDs array Populated if multiple possible users page IDs (parent for users pages)  

Additional methods and properties

In addition to the methods and properties above, Config also inherits the methods and properties of these classes:

API reference based on ProcessWire core version 3.0.137

Twitter updates

  • New post: An introductory look at ProcessWire LoginRegisterPro, a module for providing new user registration, secure logins, profile editing, and more— More
    13 December 2019
  • ProcessWire 3.0.146 on the dev branch contains about 22 commits with a combination of useful upgrades and issue report resolutions, more details in this forum post: More
    22 November 2019
  • ProcessWire 3.0.144 and 3.0.145 add improved field template context override settings and include a new Inputfields API, along with numerous other issue fixes, optimizations and improvements to the core. More
    8 November 2019

Latest news

  • ProcessWire Weekly #292
    In the 292nd issue of ProcessWire Weekly we're going to cover three new modules – Login Register Pro, FieldtypeImageFromPage, and PwQuickFixes – as well as introduce a very interesting new site of the week. Read on!
    Weekly.pw / 14 December 2019
  • Login Register Pro
    This week we’ll take a look at LoginRegisterPro — a new module that provides an all-in-one, self contained module for providing new user registration, secure logins, profile editing, and more. It does this all in a manner that is reliable, efficient, comprehensive and secure.
    Blog / 13 December 2019
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer