Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jul 2003
    Posts
    111

    Default Switching to SuPHP - remove php_value and correct permission!

    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. #2
    Member
    Join Date
    Jun 2006
    Posts
    65

    Default

    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/" {} \;
    Last edited by lngtanseco; 11-12-2008 at 11:51 AM.

  3. #3
    Member
    Join Date
    Jul 2003
    Posts
    111

    Default

    Quote Originally Posted by lngtanseco View Post
    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/" {} \;
    Thank you!

  4. #4
    Member
    Join Date
    Jun 2006
    Posts
    65

    Default

    You're welcome!

Similar Threads & Tags
Similar threads

  1. Switching to suPHP
    By Hitakashi in forum cPanel and WHM Discussions
    Replies: 13
    Last Post: 07-07-2011, 06:09 PM
  2. Catastrophic problem after switching to suPHP
    By konrath in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 09-08-2010, 10:02 AM
  3. Replies: 21
    Last Post: 03-27-2010, 04:41 PM
  4. Pitfalls after rebuild and switching PHP from DSO to suPHP
    By santrix in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 10-20-2009, 03:22 AM
  5. What is the correct permission to?
    By konrath in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 09-21-2009, 01:20 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube