Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Switching to SuPHP - remove php_value and correct permission!

Discussion in 'General Discussion' started by arhs, Nov 12, 2008.

  1. arhs

    arhs Well-Known Member

    Joined:
    Jul 4, 2003
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    166
    We’re switching to SuPHP setup; I’ve created the following bash scripts with my limited bash knowledge.

    To remove ‘php_value’ from the .htaccess file:

    Code:
    #!/bin/bash
    
    for i in `ls /home/*/public_html/.htaccess` ; do cat $i | sed "s/php_value/###php_value/g" > $i.new; mv -f $i.new $i;done
    To correct the permission on the files and directory:

    Code:
    #!/bin/bash
    
    for user in `ls /var/cpanel/users`; do
    	chown -R ${user}:${user} /home/${user}/public_html
    	chmod 755 /home/${user}/public_html
    	find /home/${user}/public_html -group nobody -exec chgrp ${user} {} \; -print0
    	find /home/${user}/public_html -perm 777 -type d -exec chmod 755 {} \; -print0
    	find /home/${user}/public_html -perm 666 -type f -exec chmod 644 {} \; -print0
    	find /home/${user}/public_html -perm 777 -type f -exec chmod 644 {} \; -print0
    
    done
    I want to remove all the ‘php_value’ from every .htaccess file. This is working but it only removes the ‘php_value’ from the ‘public_html’ directory, .htaccess file.

    Any help appreciated! :)

    Thanks,
     
  2. lngtanseco

    lngtanseco Well-Known Member

    Joined:
    Jun 9, 2006
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    156
    Below code should go through ALL public_html directories and subdirectories and find ANY file containing the characters "php_value" then replace it accordingly.

    Code:
    find /home/*/public_html/. -type f -exec sed -i "s/php_value/###php_value/" {} \;
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #2 lngtanseco, Nov 12, 2008
    Last edited: Nov 12, 2008
  3. arhs

    arhs Well-Known Member

    Joined:
    Jul 4, 2003
    Messages:
    116
    Likes Received:
    0
    Trophy Points:
    166
    Thank you! :)
     
  4. lngtanseco

    lngtanseco Well-Known Member

    Joined:
    Jun 9, 2006
    Messages:
    64
    Likes Received:
    0
    Trophy Points:
    156
    You're welcome!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice