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 4120094
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:10:35+00:00 2026-05-20T23:10:35+00:00

In linux I want to run a gnome zenity progress bar window from PHP.

  • 0

In linux I want to run a gnome zenity progress bar window from PHP. How zenity works is like this:

linux-shell$ zenity --display 0:1 --progress --text='Backing up' --percentage=0
10
50
100

So the first command opens the zenity progress bar at 0 percent. Zenity then takes standard input numbers as the progress bar percentage (so it will go from 10% to 50% to 100% when you type those numbers in).

I can’t figure out how to get PHP to type in those numbers though, I have tried:

exec($cmd);
echo 10;
echo 50;

And:

$handle = popen( $cmd, 'w' );
fwrite( $handle, 10 );

And:

$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w")  // stdout is a pipe that the child will write to
);

$h = proc_open($cmd, $descriptorspec, $pipes);

fwrite($pipes[1], 10);

But none of them updates the progress bar. In what way can I mimic the effect of the stdin on the linux shell to get zenity to update its progress bar?

  • 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-20T23:10:36+00:00Added an answer on May 20, 2026 at 11:10 pm

    Your first executes the command with a copy of the current script’s stdin, not the text you provide.

    Your second fails because you are forgetting the newline. Try fwrite($handle, "10\n") instead. Note that zenity seems to jump to 100% when EOF is reached (e.g. by the implicit close of $handle at the end of your PHP script).

    Your third fails because you are forgetting the newline and you are writing to the wrong pipe. Try fwrite($pipes[0], "10\n") instead, and remember the same note regarding EOF as above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I really want to write .NET apps that run on any platform (PC, Linux
I want to execute something in a linux shell under a few different conditions,
I want to stop losing precious time when dealing with Linux/Unix's shell. If I
I want to open a folder window, in the appropriate file manager, from within
I want to run a program in linux without the X borders. It's a
I want to run a java program on a linux server in profiling mode.
In linux make file: I want to run the output program only in case
I have an application in linux, which is compiled successfully. I want to run
I want to use a linux command line tool from my Java program. I
I want to start tomcat on command prompt in linux and want to run

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.