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 PHP no longer working

Discussion in 'General Discussion' started by bronco92, Aug 19, 2009.

  1. bronco92

    bronco92 Member

    Joined:
    Nov 18, 2006
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Two days ago (before the latest release of cpanel) the following script in our postwwwacct file was working fine.

    The php is no longer being read.

    Has something changed in the newest release?

    Code:
    #!/usr/bin/php -q
    <?php
    $opts = array();
    $argv0 = array_shift($argv);
    while(count($argv)) {
    $key = array_shift($argv);
    $value = array_shift($argv);
    $opts[$key] = $value;
    }
    $user_acc = $opts['user'];
    $plan = $opts['plan'];
    
    
    $directory = "/home/".$user_acc."/public_html";
    recursive_remove_directory ($directory);
    
    function recursive_remove_directory($directory, $empty=FALSE)
     {
         if(substr($directory,-1) == '/')
         {
            $directory = substr($directory,0,-1);
         }
         if(!file_exists($directory) || !is_dir($directory))
         {
            return FALSE;
         }elseif(is_readable($directory))
         {
            $handle = opendir($directory);
             while (FALSE !== ($item = readdir($handle)))
             {
                 if($item != '.' && $item != '..')
                 {
                     $path = $directory.'/'.$item;
                     if(is_dir($path)) 
                     {
                         recursive_remove_directory($path);
                    }else{
                         unlink($path);    
                                                                                     }
                 }
            }
            closedir($handle);
             if($empty == FALSE)
           {
                if(!rmdir($directory))
                {
                    return FALSE;
                }
            }
        }
        return TRUE;
     }
    
    if ($plan == "template1") {
    rename("/home/".$user_acc."/t1/" , "/home/".$user_acc."/public_html");
    } 
    
    if ($plan == "template2") {
    rename("/home/".$user_acc."/t2/" , "/home/".$user_acc."/public_html");
    } 
     
    chmod("/home/".$user_acc."/public_html/style.css", 0777);
    chmod("/home/".$user_acc."/public_html/siteinfo.php", 0777);
    
    $site_info_file = "/home/".$user_acc."/public_html/siteinfo.php";
    $fh = fopen($site_info_file, 'w') or die("can't open file");
    $stringData = " ";
    fwrite($fh, $stringData);
    fclose($fh);
    
    $site_info_file1 = "/home/".$user_acc."/public_html/siteinfo.php";
    $fh = fopen($site_info_file1, 'w') or die("can't open file");
    $stringData = '<?php
    include ("database_script.php");
    $business_id_gen = "'.$user_acc.'";?>';
    fwrite($fh, $stringData);
    fclose($fh);
    
    
    ?>

    Any help will be appreciated. Thanks.
     
  2. bronco92

    bronco92 Member

    Joined:
    Nov 18, 2006
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Thanks to Jamyn at cpanel support, this has been fixed.

    #!/usr/bin/php -q


    was changed to:


    #!/usr/loca/bin/php -q

    Issue fixed.
     
Loading...

Share This Page