How to Use P4Web

 


Contents

  1. How P4Web Works
  2. How to Install P4Web
  3. How to Start P4Web
  4. The 'p4web' Command
  5. Connecting to P4Web
  6. How to Stop P4Web

 


How P4Web Works

P4Web is Perforce client program that runs on any platform. It can be used either as a private Helper or as a public Viewer:

  • A P4Web Helper turns your Web browser into a complete Perforce user interface. You can use it to work with files and access depot information. To be used as a Helper, P4Web must be running on a machine that can read and write files in your workspace. Typically, this is your Macintosh workstation, your Windows workstation, or the Unix machine you log in to. No one else can access your P4Web Helper -- it accepts connections from your browser only.

  • A P4Web Viewer allows read-only access to depot files and information. P4Web makes an ideal document server, allowing users to browse current and previous versions of files stored in a Perforce depot. Anyone can point their browser to a P4Web Viewer. Perforce protections can be used to control P4Web Viewer access the depot if necessary.

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. To your web browser, P4Web looks very much like a web server. To a Perforce server, P4Web looks like any other Perforce client program.

 


How to Install P4Web

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

  • Installing P4Web on Macintosh

    Download the "p4web.sit.hqx" file and unstuff it. Put the three resulting files ("p4web", "MacP4", and "README.html") anywhere you want. "p4web" is the P4Web Helper application. "MacP4" is an application that provides a command-line interface to Perforce. It is activated by P4Web to do interactive resolves.

    Read the "README.html" file, which will tell you how to set the appropriate values for P4PORT, P4CLIENT, and P4USER.

  • Installing P4Web on Windows

    Download the P4Web installer program, perforce.exe, and run it on your Windows workstation. This installs the P4Web executable, p4web.exe. It will also install the Perforce command line client, p4.exe, if it's not already installed.

    The installer assumes you want to run a P4Web Helper on port 8080. You can override those defaults during the installation. You can also start up additional P4Webs on different port numbers regardless of what you chose when you installed it; see "Starting P4Web", below.

  • Installing P4Web on Unix

    Download the p4web executable for your Unix platform, and put it in a directory in your path. If you are installing it for everyone to use, put it in /usr/local/bin or equivalent. Make sure the p4web file has execute permission.

    If you do not already have p4 (the Perforce command line client) on your system, download the executable from the Perforce Downloads page and install it as well.

 


How to Start P4Web

Before you can point your browser to it, the P4Web program must be up and running.

On Macintosh, double-click P4Web to start it up. To configure P4Web on a Mac, hold down the option-key as it starts up. You will be presented with a configuration dialog box.

On Windows, you can start the P4Web you configured during installation by clicking Start->Programs->Perforce->P4Web. You can also start a P4Web with an alternate configuration using the p4web command, as described below. Run p4web in the Start->Run window or with the start command in a Command Prompt window.

On Unix you can start the P4Web program with p4web command, as described below.

 


The 'p4web' Command

Run the p4web command to start a P4Web program from a command shell. When P4Web starts up, it displays information about the Perforce user, client, and server port it's using, and the URL your browser should use to connect to it. The p4web command syntax is:

p4web [-w port] [-b] [-l] [global_options] [-h] [-V]

  • The -w port flag can be used to designate a P4Web port number other than the default. This is the port number you'll use to point your browser to P4Web.

    On Unix, the default port number is unique to each user and is displayed by the p4web command at startup. (If the default P4Web port number for your username conflicts with a port address used by another process on your system, you'll have to override it with the -w option.)

    On Windows the default P4Web port is 8080.

  • The -b flag starts P4Web as a browse-only Viewer. This overrides the default behavior, which is to start up as a Helper that can read and write files in a workspace on the local machine.

  • The -l flag starts a P4Web that accepts connections only from a browser running on the local machine. Without this option, P4Web accepts connections from an authorized browser on any machine. (See Passwords and Authorization for more information.)

  • [global_options] is the subset of Perforce global options supported by P4Web:

    -u user (Perforce user name)
    -P password (Perforce user password)
    -c client (Perforce client name)
    -H host (Perforce client host)
    -p host:port (Perforce server host and port number)

    For more information about these flags, see the Global Options section in the Perforce Command Reference.

  • The -h flag shows the p4web command flags, but does not start the program running.

  • The -V flag shows the p4web version information, but does not start the program running.

 


Connecting to P4Web

Once you've started a P4Web Helper or Viewer you can connect to it with your Web browser. Point your browser to:

http://localhost:nnnn/

where nnnn is your P4Web's port address. (If your browser is running on a different machine than P4Web, use the name of the machine P4Web is running on instead of "localhost".) Enter your Perforce username and password at your browser's prompt to begin using P4Web.

 


How to Stop P4Web

To stop a P4Web program running on...

  • Macintosh: choose QUIT from the FILE menu.

  • Windows: close the P4Web console window, or use Ctrl-C in the window it's running in.

  • Unix: kill your "p4web" process.

 

Home