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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:12:57+00:00 2026-06-11T15:12:57+00:00

I am running the following proc_open function. When the page is loaded, I get

  • 0

I am running the following proc_open function. When the page is loaded, I get the error:

Use of undefined constant STDOUT - assumed 'STDOUT'`

How should I set STDOUT and STSDERR correctly?

PHP Snippet

$cmd = 'psql -p 5432 -d nominatim';

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

$pipes = null;

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

Update

<?php

    $cmd = 'psql -p 5432 -d nominatim';

    $descriptorspec = array(
        0 => array('pipe', 'r'), // stdin
        1 => array('pipe', 'w'), // stdout
        2 => array('pipe', 'a') // stderr
    );

    $pipes = null;

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

?>

When I chmod 755 test.php and run ./test.php in the command line (CentOS), I get the error output:

: No such file or directory
: command not found
./test.php: line 3: =: command not found
: command not found
: command not found
./test.php: line 5: syntax error near unexpected token `('
'/test.php: line 5: `   $descriptorspec = array(

This is puzzling, = is not a command?


Update 2

#!/usr/bin/php <?php

    $cmd = 'psql -p 5432 -d nominatim';

    $descriptorspec = array(
        0 => array('pipe', 'r'), // stdin
        1 => array('pipe', 'w'), // stdout
        2 => array('pipe', 'a') // stderr
    );

    $pipes = null;

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

?>

I get the output:

Status: 404 Not Found
X-Powered-By: PHP/5.3.16
Content-type: text/html

No input file specified.
  • 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-11T15:12:58+00:00Added an answer on June 11, 2026 at 3:12 pm

    You may use :

    $descriptorspec = array(
        0 => array('pipe', 'r'), // stdin
        1 => array('pipe', 'w'), // stdout
        2 => array('pipe', 'a') // stderr
    );
    

    instead

    Have a look to the manual

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

Sidebar

Related Questions

When running the top level maven target test I get the following error: FATAL:
Running the following line in my script gives me a Permission denied error: $config_out
I am running following code, getAccount() is a static function, $ac_info = AccountClass::getAccount($ac_code); print_r($ac_info);
I'm running in php the following: $res = proc_open($cmd, $descriptorspec, $pipes, C:\\xampp\htdocs\\,null,array('bypass_shell'=>true)); Problem is
I am able to get all the processes that are running using the following
I'm getting following error if i'm running a stored-procedure Cannot insert duplicate key row
I am running following LINQ query in order to group by CategoryID var test
I am running following code to create bmp image from pdf using Ghost4j i
I am running following query. SELECT T1.C1, T2.C2..., IF( T1.C1<>T2.C1,Changed,1) AS NewColumn From T1
I am running following query.. Select T1.* from T1 LEFT JOIN T2 ON T1.C1

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.