Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6326057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:00:38+00:00 2026-05-24T17:00:38+00:00

I’m using the P4PHP API to build a GUI that allows users to mass

  • 0

I’m using the P4PHP API to build a GUI that allows users to mass create/update client specs. This works great as long as a client is unlocked, but for locked clients the API isn’t picking up the -f flag (or at least I don’t think it is). I get the below error message when trying to save a locked client. This is weird because I have a Python script that does pretty much the same thing using the Python p4 API and it uses the same line to save a client, but it does pick up the -f flag. I’m not sure what to do here.

[Error]: Locked client ‘php_test_client’ owned by ‘owner1’; use -f to
force update.

Here is my php code:

$p4 = new P4();   //instantiate p4 object
$p4->port = 'perforce:1666';   //set p4 port
$p4->user = $pUser;  //set p4 user
try{
    $p4->connect();
    $p4->run_login($pPass);   //login with provided p4 pass
    $client = $p4->fetch_client($cNameSub);
    echo "client fetched: " . $cNameSub ."\n";
    $client['Client']= $cNameSub;
    $client['Description']= $cDescrSub;
    $client['Owner']= $cOwnerSub;
    $client['Host']= $cHostSub;
    $client['Root']= $cRootSub;
    $client['View']= $cViewArraySub;
    $client['Options']= $cOptSub;

    $p4->save_client($client,"-f");
    $p4->disconnect();

    echo "client" . $cNameSub . " created successfully \n\n";
} catch (P4_Exception $e) {
     // output errors
    echo $e->getMessage() . "\n";
     foreach ($p4->errors as $error) {
          echo "Error: $error\n";
     }
     //TODO: log errors in db
}

I’ve also tried saving the client with the following lines, but it doesn’t work either:

//try1
$p4->input = $client;
$p4->run("client", "-f");
//try2
$p4->run("client", "-f", $client);
//try3
$p4->input = $client;
$p4->run_client("-f");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:00:40+00:00Added an answer on May 24, 2026 at 5:00 pm

    You need the -i flag also!

    This works:

    $p4->input = $client;
    $p4->run_client("-i","-f");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm making a simple page using Google Maps API 3. My first. One marker
We're building an app, our first using Rails 3, and we're having to build
I'm trying to create an if statement in PHP that prevents a single post
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.