P4Web Release 2012.1 User Guide
[Getting Started]  [How To...]  [Browser Tips]  [Glossary]  [Road Map]  

Administering P4Web

This topic covers the following aspects of P4Web administration:

P4Web is a Perforce client program that runs on any platform. It can be used either in Standard mode or Viewer mode:

To your web browser, P4Web looks like a web server. To a Perforce server, P4Web looks like any other Perforce client program. P4Web communicates with the Perforce server using the Perforce C++ API. It also communicates with your web browser, sending HTML and receiving URL requests and form input.

Installing P4Web

P4Web is available for Macintosh, Windows, and Unix. For download information, please go to the Perforce Downloads page.

To specify flags for P4Web services, stop the service and set P4WEBSERVICEFLAGS as follows:

p4 set -S "Perforce Web" P4WEBSERVICEFLAGS="flags"

For example:

p4 set -S "Perforce Web" P4WEBSERVICEFLAGS="-M -sBCDEG"

Then restart the service.

Starting P4Web

When you start P4Web in Standard mode or Viewer mode, you specify the Perforce user and client that are used when P4Web connects to the Perforce server. The client view and protections defined for the specified client and user determine the scope and type of access to the Perforce server that P4Web has. For details about defining protections and client views, refer to the P4 User's Guide.

Starting P4Web on Windows

If you installed P4Web as an application, choose Start>Programs>Perforce>Launch P4Web Application. To specify settings other than those you configured when you installed P4Web, invoke it from the command line.

If you are running P4Web as a service, P4Web is started immediately after you install it. To verify that P4Web has started, go to the Windows Control Panel. Under Administrative Tools>Component Services, click on Services and find Perforce Web. If P4Web is not running, click Start the service in the left-hand column.

Invoking P4Web from the command line

To start an instance of P4Web, invoke p4web, specifying desired options using the following command line flags:

Command line flag Description
-b Specifies Viewer mode (no authentication). Users are not prompted to enter a password to connect to P4Web. However, if your user name requires a password when accessing Perforce, specify that password using the -P flag when you start P4Web. The default mode is Standard mode, in which P4Web can read and write files in a client workspace on the machine where P4Web is running.
-B Specifies Viewer mode plus authentication. Each user is prompted to enter user name and password the first time they browse to the P4Web instance, and whenever tickets expire (if the target server is using ticket-based authentication).
-C charset Character set to be used for translation of Unicode files.
-c client Specifies the Perforce client workspace to be used to connect to the Perforce server.
-d path Specify a default file filter (for performance).
-h Displays the p4web command line flags but does not start the program.
-H host Specifies the Perforce client workspace host machine. Because the client workspace resides on the machine where P4Web is running, there is typically no need to specify this flag.
-i Specify this flag in the /etc/inetd.conf file if starting P4Web using inetd.

-In "name"

-Io "comment"

Override the Perforce server's Zeroconf human-readable name or comment.
-l Accept connections only from a browser running on the local machine. By default, P4Web accepts connections from an authorized browser on any machine. (See Passwords and Authorization for more information.)
-L logfilename Log all requests sent to P4Web to the specified file. If the log file name includes spaces, specify it in double quotes.
-M Accept connections from multiple users. By default, P4Web connects to the server and issues commands using the single user specified by the -u flag. When you enable connections from multiple users, a single instance of P4Web can interact with the Perforce server on behalf of all (valid) users. When users connect, they are prompted for username and password, and are required to choose a client workspace (if they intend to sync and edit files) or to select Browse mode (if they intend only to view information and browse files).
-m mimefilepath

Specify a custom MIME type map file.

In the MIME type map file, you can map new types and override existing mappings, to control how your browser handles files returned to it by P4Web. As an alternative to the -m flag, you can set the P4WEBMIMEFILE environment variable (unless you are starting P4Web as a Windows service, in which case you must use the -m flag).

The custom MIME file must be a plain text file, specifying each type mapping on a separate line. Each line must begin with a period, followed by the extension and its mapping.


.h text/plain
.c text/plain
.C text/plain
.cc text/plain
.cpp text/plain
.java text/plain
.pl text/plain
.py text/plain

-p host:port Perforce server host and port number. Defaults to your local host machine and port 1666.
-P password Specifies the password for the Perforce user to be used to connect to the Perforce server. Note: This option can only be used in Viewer mode (-B or -b flag).
-r path Restrict to clients with roots in the specified path (for security).
-s options

Specifies security-related options. Specify all options in a single instance of the -s flag, for example -saBD. (Note: Remote users are users whose browser is running on a different machine than the machine where P4Web is running. The -ss and -sq options affect both local and remote users. All other options affect only remote users.) Options are as follows:

Options a Prevent remote users from switching client workspaces.
B Enable remote users to use client workspaces that have no owner.
C Accept connections from any client.
D Enable remote users to create client workspaces. Note: by default, client workspaces created by local users are assigned a client root that cannot be edited. To enable local users to edit the client root, specify -sD.
E Allow remote users to edit the Root, Altroots and Owner fields in client workspace specifications.
F Enable display of startup flags for remote users.
G Accept connections from remote users if client has empty Host field.
h To reduce requests to the Perforce server, do not allow requests for integration history from server when displaying revision history, submitted changelists, and jobs.
i Disable integration.
L Enable remote users to create, edit, and resolve symlinks.
N Enable remote users to use null-rooted client workspaces.
P Enable remote users to use clients that contain the recursive wildcard (...) in client workspace views.
q Disable the display of Revision History. Note: When you disable the display of Revision History, P4Web displays links to the file contents on the Path Browser page. This feature enables you to use P4Web in viewer mode as a document server. In Standard mode, you can browse your client workspace on the system where P4Web is running. When you are in Depot View, all Path Browser links take you to the depot version of the file. In Workspace View, all Path Browser links take you to the local version of the file.
r Disable the p4 commands feature.
s Generate https links instead of http links. (See Configuring P4Web with https for more information.)
w Suppress the display of client workspace links to files to remote users.
x Suppress the display of users' email addresses to remote users.
-T tabs Specifies the tabs to be displayed. Specify the first letter of the each of the desired tabs. If you omit the Files tab, the first tab you specify is the first tab that is displayed in your browser. The Setting tab cannot be hidden.

Example: p4web -T fps displays the Files, Pending and Submitted Changelist tabs.

An additional, previously hidden tab might be displayed, if it is linked from some other page. For example, -Tf displays the Submitted Changelist tab if you click a changelist number on the Revision History page. When you click on the Files tab, the Submitted Changelist tab is hidden again.

-u user Specifies the Perforce user name to be used to connect to the Perforce server. Note: This option cannot be used with the -M flag.
-U username Mandatory on UNIX systems if you start P4Web as root. For security purposes, P4Web drops its root privileges after binding to its listen address.
-V Displays version information but does not start P4Web.
-w port Specifies the port on which P4Web accepts browser requests. On Windows and Macintosh, the default port for P4Web is 8080. On UNIX and related platforms, the port used by P4Web is the 5000 plus the P4Web user's UID. For example, if the user's UID is 525, then, by default, P4Web uses port 5525. You can start multiple instances of P4Web using on different port numbers regardless of the port number chosen during installation. To override the default port, specify another port using the -w option.
-0 Register as a Zeroconf service. (Flag is zero, not the letter O). Note: the Avahi implementation of Zeroconf does not support an option for restricting the advertising of services to the localhost machine. You can prevent other machines from connecting by specifying the -l flag when you start P4Web, but if you are using Avahi, the P4Web instance is visible to other machines.

Configuring P4Web with https

To specify that all links generated in a P4Web page are https links, start P4Web with the -ss flag. Note that P4Web does not accept https requests. To convert https requests to http so P4Web can process them, use an https converter such as stunnel. P4Web RSS feeds also support https, if you configure stunnel to provide valid certificates and if your RSS reader accepts https requests.

For example, to set up stunnel with P4Web on Windows:

  1. Download and install stunnel from http://www.stunnel.org/
  2. Create a text file called stunnel.p4web, containing the required configuration settings. For example, on Windows, enter the following settings:
        accept = 8080
        connect = 8081
        TIMEOUTclose = 0

  3. Start stunnel. Example (full paths required):   c:\\stunnel\\stunnel c:\\stunnel\\stunnel.p4web
  4. Start p4web. Example:   c:\\perforce\\p4web -w 8081 -ss
Direct your P4Web users to browse to https://stunnelhost:8080.

Connecting to P4Web

To connect to an instance of P4Web, enter the following URL in the address bar of your browser:

http://localhost:nnnn/   (where nnnn is the port on which p4web accepts browser requests.)
The Perforce server port address is set in the environment variable P4PORT, unless you are running P4Web as a service on Windows. If you are running P4Web as a service, the port address is set in the environment variable P4WEBPORT.

Note: If your browser and P4Web are running on different machines, specify the name of the machine where P4Web is running instead of "localhost". When prompted, enter your Perforce username and password (if any).

Stopping P4Web

To stop a P4Web program:

Configuring the P4Web favicon

A favicon (short for "favorites icon") is an icon associated with a particular website or webpage. To override P4Web's default favicon, either add the desired icon as //depot/favicon.ico or set P4WEBFAVICON to the depot path of the desired icon file in your depot. The favicon is served to Firefox and Safari browsers, and to Opera browsers unless the user was logged into the browser session using a cookie. (Opera fails to serve the cookie when it requests /favicon.ico so the internal version will be served instead. For details about why P4Web uses cookies to log users in, see the P4Web release notes.)

To enable Internet Explorer to display the P4Web favicon, you must be running version 6 or higher. To display the icon, your users must perform the following steps:

  1. Clear the Internet Explorer cache.
  2. Clear the cookies associated with the host where P4Web is running.
  3. Clear history associated with that host.
  4. Restart Internet Explorer.
  5. Additional step for Internet Explorer 6: Add the page to your favorites. If you already have the page in your favorites folder, remove it and add it again. The favicon is displayed in the URL field when you open the page using the Favorites menu.

User Documentation

After you've pointed your browser to P4Web, use its online help to view the user documentation. You can also access the online help from the Perforce web site, as follows:

Copyright 2012 Perforce Software. All rights reserved.