Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Member
    Join Date
    Sep 2004
    Posts
    7

    Question postwwwacct calling command line php

    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 Code:
    #!/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. #2
    Member PWSowner's Avatar
    Join Date
    Nov 2001
    Location
    ON, Canada
    Posts
    2,994

    Default

    Are the scripts owned by root?
    Mike
    WHM and cPanel Scripts (join our "Scripts Club")
    D/A Photography

  3. #3
    Member
    Join Date
    Sep 2004
    Posts
    7

    Default

    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
    Last edited by malk; 07-01-2005 at 10:02 AM.

  4. #4
    Member
    Join Date
    Jun 2005
    Posts
    6

    Default

    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. #5
    Member
    Join Date
    May 2005
    Posts
    21

    Default

    Quote Originally Posted by argintxe2
    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!
    What's CLI?

  6. #6
    Member
    Join Date
    Nov 2003
    Location
    NC, USA
    Posts
    55

    Default

    cli php is an apache module, cgi php is standalone, from what i gather

Similar Threads & Tags
Similar threads

  1. running php through command line error
    By manokiss in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 07-31-2008, 02:41 PM
  2. Command line PHP dead after upcp last night.
    By mmatos in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 01-12-2008, 12:54 PM
  3. Upgrade to php 5.1.4 - No PHP On Command Line
    By xaze in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-02-2007, 07:24 AM
  4. GD, curl compile with php on command line
    By innovative2001 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-20-2006, 07:29 PM
  5. email from php or command line not working
    By redlorry919 in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 02-06-2006, 02:47 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube