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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:53:15+00:00 2026-06-04T08:53:15+00:00

For some strange reason this echo system(echo ‘echo hello > /dev/pts/2’ | /usr/bin/at 19:36);

  • 0

For some strange reason this

echo system("echo 'echo hello > /dev/pts/2' | /usr/bin/at 19:36");

Refuses to work from my php script, however the command works fine when I just enter it through command line.

I know php has permission to execute some commands. I can run ‘ls’ from the php script but not the ‘at’ command. I’ve tried playing around with file permissions, but so far to no avail 🙁

edit

Permissions for /usr/bin/at are:

-rwxr-sr-x 1 daemon daemon 42752 Jan 15 2011 at

I think it’s a permissions problem, if I execute the php file from my ssh terminal it works fine, but not from the web.

  • 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-04T08:53:16+00:00Added an answer on June 4, 2026 at 8:53 am

    What you are executing is

    echo 'hello' > /dev/pts/2 | /usr/bin/at 19:36
    

    meaning

    echo 'hello' > /dev/pts/2
    

    and pipe stdout to /usr/bin/at 19:36 but since you already redirected the echo to /dev/pts/2, this will be empty. What you probably meant to do is:

    echo system("echo 'echo hello > /dev/pts/2' | /usr/bin/at 19:36");
    

    You might also want to use shell_exec to pass the command through a shell or alternatively proc_open which gives you better control over stdin/out/err of the command you are executing. Your example would correspond to (adapted example from php.net docs):

    <?php
    $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
       2 => array("pipe", "w")  // stderr is a pipe that the child will write to
    );
    
    $process = proc_open('/usr/bin/at', $descriptorspec, $pipes);
    
    if (is_resource($process)) {
        fwrite($pipes[0], 'echo "hello" > /dev/pts/2');
        fclose($pipes[0]);
    
        $stdout = stream_get_contents($pipes[1]);
        fclose($pipes[1]);
    
        $stderr = stream_get_contents($pipes[2]);
        fclose($pipes[2]);
    
        $return_value = proc_close($process);
        echo "command returned $return_value. stdout: $stdout, stderr: $stderr\n";
    } else {
        echo "Process failed";
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some strange reason, in iPhone OS 3.0 this doesn't work: I made a
I know this is a basic question but for some strange reason I am
For some reason this PHP code below will not work, I can not figure
For some strange reason g++ (versions 4.5.0 and 4.5.2) cannot compile this code: bool
This is a Windows Phone 7 project. For some strange reason, Visual Studio 2010
For some strange reason I am getting this strange error when I do ctrl+space
well for some strange reason IE gives me and InvalidAuthenticityToken error almost every time
I'm passing two strings between two activities and for some strange reason, the strings
For some strange reason, I need to call the operator->() method directly. For example:
For some strange reason I get a weird error. I have an element (which

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.