Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Email Pipe issues

Discussion in 'E-mail Discussion' started by fifebirder, Jan 11, 2016.

  1. fifebirder

    fifebirder Registered

    Joined:
    Jan 11, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    scotland
    cPanel Access Level:
    Website Owner
    Hi Guys

    New to this forum, i am relatively inexperienced at PHP but not a beginner or noob.

    I have set up in cpanel an email address and set up forwarding as such

    |/home/fifebirder/test.php

    i am using x3 style in my panel.

    Code:
    test.php file is :-
    
    #!/usr/bin/php -q
    <?php
    
    $fd = fopen( "php://stdin", "r" );
    
    $message = "";
    
    while ( !feof( $fd ) )
    {
      $message .= fread( $fd, 1024 );
    }
    
    fclose( $fd );
    
    // The $message variable now holds the entire message text,
    // which you can use for further processing.
    
    ?>
    
    
    as you can see i have my shebang in my basic script, i have only created a basic script as i know the rest of the script in my "real" forwarding script works fine.

    when i send an email to the email address that gets forwarded i keep getting this in my exim_mainlog file

    |/home/fifebirder/test.php (my@email.address) <my@email.address> R=virtual_aliases_nostar T=virtual_address_pipe: Child process of virtual_address_pipe transport returned 127 (could mean unable to exec or command does not exist) from command: /home/fifebirder/test.php

    my@email.address has been inserted instead of my real email address which i can send and recieve to.

    I have test.php set to 755 permission, have also tried setting it to 700.

    Can someone please help as i have now spend many hours reading online hints and tips and i am getting no where.

    Apologies if this is not the correct format to ask for help.
     
    #1 fifebirder, Jan 11, 2016
    Last edited by a moderator: Jan 12, 2016
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,585
    Likes Received:
    440
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    Your test.php script is posted around the Internet. Here's one site with some additional details you might find useful:
    a2hosting.com/kb/cpanel/cpanel-mail-features/forwarding-incoming-e-mail-messages-to-a-script-file
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,491
    Likes Received:
    1,964
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    The output suggests you may have simply entered the path to the script. Instead, you have to enter it like this:

    Code:
    |php -q /home/user/public_html/path/script.php
    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. fifebirder

    fifebirder Registered

    Joined:
    Jan 11, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    scotland
    cPanel Access Level:
    Website Owner
    cPanelMichael,

    x3 does not allow the pipe symbol.
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,491
    Likes Received:
    1,964
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    I was noting the fact that it looks like you may have left out "php -q".

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. fifebirder

    fifebirder Registered

    Joined:
    Jan 11, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    scotland
    cPanel Access Level:
    Website Owner
    i have got it sort of working but form some reason
    [Removed - Please paste output in CODE tags]

    isnt getting the email, checking email logs says that it has been delivered, files have 1777 permissions
     
    #6 fifebirder, Jan 12, 2016
    Last edited by a moderator: Jan 12, 2016
  7. fifebirder

    fifebirder Registered

    Joined:
    Jan 11, 2016
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    scotland
    cPanel Access Level:
    Website Owner
    Code:
    PHP Warning:  fopen(MAIL.txt): failed to open stream: Permission denied in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 11
    
    
    Warning: fopen(MAIL.txt): failed to open stream: Permission denied in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 11 PHP Warning:  fwrite() expects parameter 1 to be resource, boolean given in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 12
    
    
    Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 12 PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 13
    
    
    Warning: fclose() expects parameter 1 to be resource, boolean given in /home/fifebirder/public_html/Forum/specialscripts/test.php on line 13
    
     
    #7 fifebirder, Jan 12, 2016
    Last edited by a moderator: Jan 12, 2016
  8. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,585
    Likes Received:
    440
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    You might do better to find the author of the script, or a coding forum for support with this. The problem is with your script, not your cPanel.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice