Skip to content

Instantly share code, notes, and snippets.

@hersoncruz
Created August 15, 2016 17:09
Show Gist options
  • Save hersoncruz/411144884fa0aa1c455d38589006b232 to your computer and use it in GitHub Desktop.
Save hersoncruz/411144884fa0aa1c455d38589006b232 to your computer and use it in GitHub Desktop.
Install PHP Phalcon on Debian(8) from the ubuntu ppa sources
#!/bin/bash
#
not_root() {
echo "ERROR: You have to be root to execute this script"
exit 1
}
# Check if user is root
[ $EUID != 0 ] && not_root
UBUNTU_VERSION=$(whiptail --title "Install PHP Phalcon for Debian(8)" --radiolist "\nSelect Ubuntu Version" 15 50 4 "vivid" "Ubuntu Vivid 15.04" ON "utopic" "Ubuntu UTopic 14.10" OFF "trusty" "Ubuntu Trusty 14.04" OFF "precise" "Ubuntu Precise 12.04" OFF 3>&2 2>&1 1>&3)
clear
if [ "$UBUNTU_VERSION" != "" ]; then
echo "Install required packages..."
apt-get install -yqq devscripts build-essential
echo "DONE"
echo "deb-src http://ppa.launchpad.net/phalcon/stable/ubuntu ${UBUNTU_VERSION} main" > /etc/apt/sources.list.d/pogo.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1E569794
echo "APT-GET Update..."
apt-get update -yqq
echo "DONE"
echo -n "Building phalcon package..."
apt-get source -yqq --build php-phalcon
echo "DONE"
echo -n "Installing phalcon package..."
dpkg -i php5-phalcon_*.deb
echo "DONE"
echo -n "Activating phalcon package..."
php5enmod phalcon
echo "DONE"
echo -n "Installing phalcon devtools to /opt/phalcon-devtools..."
### If devtools directory exists we will remove it before we go on
[ -d /opt/phalcon-devtools ] && rm -Rf /opt/phalcon-devtools
### Clone new version
git clone https://github.com/phalcon/phalcon-devtools.git /opt/phalcon-devtools --quiet
### And move it to /usr/bin
[ -f /usr/bin/phalcon ] && rm -Rf /usr/bin/phalcon
ln -s /opt/phalcon-devtools/phalcon.php /usr/bin/phalcon
chmod ugo+x /usr/bin/phalcon
echo "DONE"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment