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.

/scripts/postwwwacct

Discussion in 'General Discussion' started by PHPfrog, Aug 27, 2009.

  1. PHPfrog

    PHPfrog Registered

    Joined:
    Jun 30, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I'm relatively new with using cPanels API's and scripts and have ran across a couple dilemmas I was hoping someone could shed some light on.

    Would anyone have any idea as to why the 'postwwwacct' script would run, but not process markers in a php file?

    I've uploaded the file I copied from 'http://www.premierwebsitesolutions.com/scripts/postwwwacct' for skeleton file parsing of the markers, **user** and **domain**, but it doesn't make any changes. (Thanks for the script Mike).

    It creates the domain fine, moves the skeleton files over and displays that the 'postwwwacct' is being processed, but nothing changes with the markers in my php file.

    The only change made in the 'postwwwacct' script was:
    Code:
    @pages = ("public_html/index.php");
    It works fine with the file name as 'index.html'. Does this not work with php extentioned files?

    It seems when I make a change in the skeleton directory (i.e. remove or add a marker) it uses a cache of a sort and doesn't reflect the updates. So, when if I remove '**user**' in the 'index.php' skeleton file it stays there. This happens even if I clean out the skeleton directory and upload the new updated files. Anyone know a way to get around this?

    Finally, there is one piece of data (integer) I need to process after all the scripts and creation process. Is there quick way we can pass additional data via the XmlApi account creation request or parse the file afterwards without having to worry about permissions to make the one change?

    Any and all ideas and/or suggestions are greatly appreciated.

    Thanks!
     
  2. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    This post didn't seem fully related to the 6-year old thread you posted to, so I have made your post into its own thread.

    /scripts/postwwwacct is run as root as a shell script, so there isn't anything inherent to the script that would prevent it from modifying PHP files. Perhaps there is a bug in the script that needs to be resolved?

    Be sure to be editing the correct skeleton directory. The root user's skeleton directory is used when root creates a user. If a reseller creates a user, that reseller's skeleton directory is used. Also, skeleton files are only copied at account creation time. Editing a skeleton file will not affect anything on any account that has already been provisioned.

    At this time, there is no means by which to do this via the XML API.

    If all you're doing is editing the index file to reflect simple modifications like the domain name, you can remove index.html from the skeleton directory and create an index.php instead that pulls such information from the URL being requested etc. via PHP.
     
  3. PHPfrog

    PHPfrog Registered

    Joined:
    Jun 30, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello David,

    Thanks for your responses and correcting the post location.

    I don't know how it would be a bug. If all I change is '.html' to '.php' it doesn't parse, but it will parse the markers if I leave '.html'.

    I've recently discovered that '.php' files in a subdirectory are parsing the markers fine. It seems to just have problems with that one file ('index.php') in the web directory that it doesn't touch.


    Sorry for not clarifying last time. I'm using 'root' to create the new accounts. So, I only have that one location with the skellie files. I've altered, removed and re-uploaded several times since yesterday and it's still showing the file data from yesterday before the changes.



    Thanks for the update.


    This is what I thought, but it seems to ignore the markers still.

    Thanks again.

    -james
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Are you saying your script malfunctions with .php files or that .php files are not being executed by the web server?

    Are you editing the skeleton files? If so, then accounts that have already been created should not reflect any changes. Only accounts created after the modifications should reflect changes to the skeleton files.

    What do you mean by "ignore the markers?"
     
  5. PHPfrog

    PHPfrog Registered

    Joined:
    Jun 30, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello David,

    Just the one file 'public_html/index.php'. I have another php file that parses the markers fine: 'public_html/inc/domain.cfg.php'. This is what I don't understand.


    Now I change them locally since remotely didn't seem to work either and when I remove the created domain (via Xmlapi) and everything in '/root/cpanel3-skel/public_html' each time and upload the files.


    It doesn't parse the '**user**' or '**domain**', the file is identical to the file within the skeleton directory.

    The index.php file is essentially a type of config file where I create a few constant variables. These are the two lines I'm using in the 'index.php' trying to parse '**user**' and '**domain**':

    PHP:
        define('DOMAIN_NAME''**domain**' );
        
    define('CUSTOM_CFG''**user**' );
    Thank you for your time and assistance, I really do appreciate it.

    -james
     
    #5 PHPfrog, Aug 27, 2009
    Last edited: Aug 28, 2009
  6. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    /scripts/postwwwacct executes after the account has been provisioned and the contents of the skeleton directory has been copied. If you want to modify the contents of the skeleton directory before they are copied into the newly provisioned account, use /scripts/prewwwacct instead. Alternatively, you could just edit /home/username/index.php directly.
     
  7. PHPfrog

    PHPfrog Registered

    Joined:
    Jun 30, 2009
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hello David,

    Was finally able to get the 'index.php' parsed today.

    The only thing I had done different was to force the skeleton files in ASCII during upload as opposed to allowing my FTP software to Automatically select it for me. That's the only thing I changed before it started parsing the markers.

    Could this have been my downfall?

    Feel really stupid if so... :eek:

    Thanks.

    - James
     
Loading...

Share This Page