The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

postwwwacct calling command line php

Discussion in 'General Discussion' started by malk, Jun 30, 2005.

  1. malk

    malk Member

    Joined:
    Sep 29, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    I haven't touched much perl since I picked up php in ~98, so I wanted to write postwwwacct in php. It worked fine from the shell.

    PHP:
    #!/usr/bin/php -q
    <?php

    print "\n Running postwwwacct \n";
    $message "the arguments are\n\n\n";
    foreach(
    $argv as $key => $value)
    {
            
    $message .= "$key : $value \n";
    }

    mail('me@example.com, 'postwwwacct', $message);

    ?>
    (note: this isn't the finial script, but the test one I have reduced it to)

    but then when I created an account I get this in WHM:

    Code:
    wwwacct creation finished
    Status: 404
    Content-type: text/html
    X-Powered-By: PHP/4.3.10
    
    No input file specified.
    
    Ok, I thought, maybe it doesn't like how perl is passing its variables. so I wrote a perl postwwwaccct that looked like this:

    Code:
    #!/usr/bin/perl
    
    print "Starting PostWWWAcct \n\n";
    
    $stg = "";
    
    foreach $varl (@ARGV)
    {
            $stg = $stg . $varl . " ";
    }
    
    print "$stg\n";
    
    $phpcommand = "php.postwwwacct $stg";
    print "$phpcommand\n";
    system($phpcommand);
    
    it too, worked fine form the command line. passing the arguments like expected. But I still got the 404 error in WHM.

    so tried variations on the $phpcommand:

    $phpcommand = "./php.postwwwacct $stg";
    $phpcommand = "/scripts/php.postwwwacct $stg";
    $phpcommand = "/usr/bin/php -q /scripts/php.postwwwacct $stg";

    each one working fine from the command line, but failing in WHM. I also played with permissions starting at 700, then 770, then (the dreaded) 777. All failed in the exact same way.

    Obviously, I am missing some magic token or juju dance I need to do. I guess I could have the perl postwwwacct call a web page, but I would prefer to not have it be publicly accessible and there are some classes I already have written in php that I would like not to have to rewrite.

    Any advice would be appreciated.
     
  2. PWSowner

    PWSowner Well-Known Member

    Joined:
    Nov 10, 2001
    Messages:
    2,948
    Likes Received:
    3
    Trophy Points:
    38
    Location:
    ON, Canada
    Are the scripts owned by root?
     
  3. malk

    malk Member

    Joined:
    Sep 29, 2004
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    yep.

    Code:
    -rwx------    1 root     wheel         222 Jun 30 17:02 postwwwacct
    

    edit: by the way thank you and this is on WHM 10.1.0 cPanel 10.2.0-C89 FreeBSD 5.3
     
    #3 malk, Jul 1, 2005
    Last edited: Jul 1, 2005
  4. argintxe2

    argintxe2 Member

    Joined:
    Jun 17, 2005
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Use CLI binary of PHP and the issue will be fixed. After many tryes with PHP4 and PHP5 CGI bynaries I tryed with a PHP5 CLI version and it worked!
     
  5. sllik

    sllik Member

    Joined:
    May 9, 2005
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    What's CLI?
     
  6. intel352

    intel352 Well-Known Member

    Joined:
    Nov 25, 2003
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    NC, USA
    cli php is an apache module, cgi php is standalone, from what i gather
     

Share This Page