Skip to content

Instantly share code, notes, and snippets.

@freestream
Last active August 29, 2015 14:20
Show Gist options
  • Save freestream/12cd4a73af0040f3ad20 to your computer and use it in GitHub Desktop.
Save freestream/12cd4a73af0040f3ad20 to your computer and use it in GitHub Desktop.
Lighttpd bash script to toggle between HHVM and php in a Ubuntu system.
#!/bin/bash
#
# Lighttpd bash script to toggle between HHVM and PHP.
#
# Place the file in a shared bin directory so the file can be executed as root
# ex. /usr/local/bin/toggle-hhvm
#
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if [ -f /etc/lighttpd/conf-enabled/15-fastcgi-php.conf ]; then
lighty-disable-mod fastcgi-php
lighty-enable-mod fastcgi-hhvm
echo "########################"
echo "###### Using HHVM ######"
echo "########################"
else
lighty-disable-mod fastcgi-hhvm
lighty-enable-mod fastcgi-php
echo "########################"
echo "###### Using PHP #######"
echo "########################"
fi
service lighttpd restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment