Switching to SuPHP - remove php_value and correct permission!

arhs

Well-Known Member
Jul 4, 2003
116
0
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,
 

arhs

Well-Known Member
Jul 4, 2003
116
0
166
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! :)