Skip to content

Instantly share code, notes, and snippets.

@jacques
Created May 7, 2014 07:02
Show Gist options
  • Save jacques/14496e382eea54c9709f to your computer and use it in GitHub Desktop.
Save jacques/14496e382eea54c9709f to your computer and use it in GitHub Desktop.
Script which fixes users php fcgi wrapper scripts to use the correct php binary after webmin pulls the location to binary config out of who knows where (might be related to restored accounts but the binary path was the same previously).
#!/opt/local/bin/bash
#
# Script which fixes users php fcgi wrapper scripts to use the correct php binary.
#
# Copyright (c) 2014 Jacques Marneweck. All rights rserved.
# Copyright (c) 2014 Kaizen Garden. All rights reserved.
#
set -o errexit
set -o pipefail
export PS4='[\D{%FT%TZ}] ${BASH_SOURCE}:${LINENO}: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
set -o xtrace
set -x
cd /home
for i in $(gfind -name php5.fcgi)
do
set +o errexit
echo $i
grep "exec /opt/local/bin/php" $i
if [[ $? -eq 0 ]]; then
gsed -i'' -e 's/\/opt\/local\/bin\/php/\/opt\/local\/libexec\/cgi-bin\/php/g' $i
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment