Created
September 25, 2015 16:44
-
-
Save rushipkar90/a9037d1da95329bb03da to your computer and use it in GitHub Desktop.
setup_custom_php_ini.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 1 ]; then | |
echo "No arguments supplied" | |
echo "usage: sh setup_custom_php_ini.sh <username>" | |
exit 1 | |
fi | |
homedir=`grep $1 /etc/passwd|awk -F: '{print $6}'` | |
if [ -z "$homedir" ]; then | |
echo "User doesn't exist" | |
echo "usage: sh setup_custom_php_ini.sh <username>" | |
exit 1 | |
fi | |
if [ ! -f $homedir/etc/php.ini ]; then | |
cp /usr/local/lib/php.ini $homedir/etc | |
chown $1.$1 $homedir/etc/php.ini | |
touch $homedir/.htaccess | |
hta="<IfModule mod_suphp.c>\n | |
\tsuPHP_ConfigPath $homedir/etc\n | |
</IfModule>" | |
echo -e $hta >> $homedir/.htaccess | |
chown $1.$1 $homedir/.htaccess | |
else | |
echo "php.ini already exists for user $1" | |
exit 1 | |
fi | |
exit 0 | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment