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.

Question according to mod_substitute

Discussion in 'General Discussion' started by mikesta, Feb 21, 2009.

  1. mikesta

    mikesta Member

    Joined:
    Oct 30, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    I just installed mod_substitute and tested it right away and found a very strange problem.

    I just used a .htaccess file to add my substitute rules for example like that:

    Code:
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute 's|src="http://www.asite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.bsite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.csite.com|MY OWN TEXT|i'
    And it works fine, but now I tried a few more things with regular expression like that:

    Code:
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute 's|<body?(.*[^>])>|$0 MY OWN CODE|'
    Substitute 's|</body?(.*[^>])>|MY OWN CODE $1|'
    And there the problem occurs. If I only use one of these lines, everything works fine, but if I use both of these lines, the site starts a process owned by nobody that consumes more and more CPU and RAM until the serverload is over 150 and that means the END.

    So to explain it once more with some code examples:

    That one works:
    Code:
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute 's|src="http://www.asite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.bsite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.csite.com|MY OWN TEXT|i'
    Substitute 's|<body?(.*[^>])>|$0 MY OWN CODE|'
    and that one kills the server:

    Code:
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute 's|src="http://www.asite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.bsite.com|MY OWN TEXT|i'
    Substitute 's|src="http://www.csite.com|MY OWN TEXT|i'
    Substitute 's|<body?(.*[^>])>|$0 MY OWN CODE|'
    Substitute 's|</body?(.*[^>])>|MY OWN CODE $1|'
    So the problem seems not to be the code it self because I tried it at a different server and there it worked.

    Could that be because of any PHP or WHM option? Or maybe a memory size?

    Hope someone has an idea on that.
     
Loading...

Share This Page