Created
May 12, 2015 06:37
-
-
Save simplyadrian/a5217f4e3965ab9d62ec to your computer and use it in GitHub Desktop.
a bash script to configure PHP's ini file
This file contains 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 -e | |
# | |
# | |
# Test for a reboot, if this is a reboot just skip this script. | |
# | |
if test "$RS_REBOOT" = "true"; then | |
logger -t RightScale "SYS Enable short_tags php.ini, skipped on a reboot." | |
exit 0 | |
fi | |
#Test for php.ini | |
php_ini=`ls /etc/ -1 2>/dev/null | grep php.ini$ | head -1` | |
#test for file existance | |
if test "$php_ini" = "" ; then | |
echo "No php.ini file in the configuration directory. Aborting installation!" | |
logger -t RightScale "No php.ini file in the configuration directory. Aborting installation!" | |
exit 1 | |
else | |
echo "Processing wrapper file: ${php_ini}" | |
cp /etc/php.ini /etc/php.ini.orig | |
echo 'modifying php.ini...' | |
sed -i 's/short_open_tag = Off/short_open_tag = On/' /etc/$php_ini | |
echo 'enabled short tags' | |
cat<<EOF > /etc/php.ini | |
include_path = ".:/mnt/ephemeral/campaign_store/current/lib" | |
EOF | |
echo 'added include path to php.ini' | |
if [ $? -eq 0 ]; then | |
echo "Modified php.ini..." | |
else | |
echo "Modifing php.ini failed. Aborting installation!" | |
logger -t RightScale 'Modifing php.ini failed. Aborting installation!' | |
exit 1 | |
fi | |
echo 'Done.' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment