Environment and registry variables

Helix Core Server has its own collection of about forty environment and registry variables that allow you to specify a wide variety of things, such as the name of the client workspace, the location of the database journal and error logs, as well as to configure behavior, such as which files to exclude from version control, and which editor to bring up so you can edit forms.

Most variables (except P4ROOT and P4JOURNAL) that affect the operation of the server can be set by a user with the super access levelClosed A permission assigned to a user to control which commands the user can run. See also the 'protections' entry in this glossary and the 'p4 protect' command in the Helix Core Command-Line (P4) Reference. or an operator user by using the p4 configure command with this syntax:

p4 configure set variable=value 

Example for Linux:

p4 configure set P4LOG=/opt/perforce//servers/master/logs/log 

Example for Windows:

p4 configure set P4LOG=c:\perforce\servers\master\logs\log 

Commonly used variables

P4ENVIRO stores environment variables (and Configurables) that are used across projects. For example, P4_port_CHARSET.

The file named by P4CONFIG in the current working directory (and its parent directories) define environment variables (and Configurables) that are used when working in that directory. For example, the combination of P4CLIENT, P4USER, and P4PORT. A user would typically set these so that a client applications, such as the P4 command line and the P4V visual client automatically use them. Otherwise the user would have to specify them manually when starting a session.

Do not put server environment variables in the files named by P4CONFIG and P4ENVIRO because any server environment variables in those files are ignored.

Helix Core Server administrators typically set P4JOURNAL, P4LOG, P4PORT and P4PROOT to define the environment that the server uses. (An alternative is to write startup scripts.)

Syntax for operating systems and shells

Suppose you want to set the target server with the P4TARGET environment variable.

  • On Linux for the Proxy server: export P4TARGET=mainserver:1666

  • On Windows for the Proxy service: p4 set -S "Perforce Proxy" P4TARGET=mainserver:1666

Suppose you want to set the P4CLIENT environment variable on various command shells:

Shell Environment Variable Example

UNIX: bash, ksh, sh
macOS zsh, bash

P4CLIENT=value ; export P4CLIENT

UNIX: csh

setenv P4CLIENT value

Windows command shell or PowerShell

p4 set P4CLIENT=value

Windows administrators running Helix Core Server as a service set the value of a variable:

For the specified service For all users on the local machine

p4 set -S servicename var=value

For example,

p4 set -S Perforce P4LOG="log"

where Perforce is the service name

p4 set -s var=value

For example,

p4 set -s P4PORT=ssl:myhost:1667

where users connect on port 1667

For more details on setting Helix Core Server variables in Windows and macOS, see the p4 set command.

Linux $home and Windows HOME

Many environment variables are set differently on Linux than on Windows.

On Linux, you can use $home to set environment variables. For example:

P4IGNORE=$home/myignorefile

where $home is expanded to the path of the user’s home directory.

On Windows, the user’s home directory is the value of the HOME environment variable or USERPROFILE.