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

  • Home
  • SEARCH
  • 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 8546495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:02:22+00:00 2026-06-11T13:02:22+00:00

I first execute the following command, $retVal = proc_close(proc_open(rfcomm connect \/dev\/rfcomm0 &> /dev/null 2>

  • 0

I first execute the following command,

 $retVal = proc_close(proc_open("rfcomm connect \/dev\/rfcomm0 &> /dev/null 2> /dev/null &", array(), $pipe));

I have to use proc_close right after proc_open or the command hangs my php page. Later on my script if I try to find out the PID of this background process I only get returned my grep request:

$val = shell_exec("ps aux | grep rfcomm0");

It only returns the process of my grep command:

www-data 6412 0.0 0.3 2004 624 ? S 12:23 0:00 grep rfcomm0

Now if I enter the exact same command from shell_exec into my SSH terminal on my server I get the following:

www-data  6047  0.0  0.3   1752   592 ?        S    12:10   0:00 rfcomm connect /dev/rfcomm0 
root      6415  0.0  0.4   3532   804 pts/1    S+   12:27   0:00 grep rfcomm0

The first result is the PID I want. Is PHP unable to retrieve the PID of its own processes or is there another way to solve this mystery?

Thanks!

  • 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-06-11T13:02:23+00:00Added an answer on June 11, 2026 at 1:02 pm

    You can get PID using proc_get_status …

    http://php.net/manual/en/function.proc-get-status.php

    This function returns an array which one of it’s element’s are pid. It’s input parameter is return of proc_open …

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

Sidebar

Related Questions

We have a node js script that runs a command to execute the following
Define the following in .vimrc or execute within vim command line: syn match ndbMethods
How do I execute the following shell command using the Python subprocess module? echo
I have the following thread code which executes correct first time. After that from
I am totally new to Java Mail. I first wanted to execute the program
To execute my application in iPhone first of all I have to add provisioning
When I execute a stored procedure first time, it (for example) takes 3 minutes
Is there any way to execute two bash scripts without the first one blocking?
In my code a function execute when user mouseover on a div for first
I have this issue: first, I execute a SQL query using Java and then

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.