2019-10-13 11:18:29 +07:00
|
|
|
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
|
2019-12-22 09:31:06 +07:00
|
|
|
ini_dir=$(php --ini | grep in: | sed -e "s|.*:s*||" | sed "s/ //g")
|
2019-10-29 23:39:49 +07:00
|
|
|
if [ ! "$(apt-cache search php"$2"-psr)" ]; then
|
|
|
|
sudo DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:ondrej/php -y >/dev/null 2>&1
|
|
|
|
fi
|
2019-12-22 09:31:06 +07:00
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-dev
|
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt-fast install -y php"$2"-psr
|
2019-10-13 11:18:29 +07:00
|
|
|
for tool in php-config phpize; do
|
|
|
|
if [ -e "/usr/bin/$tool$2" ]; then
|
2019-10-27 07:12:49 +07:00
|
|
|
sudo update-alternatives --set $tool /usr/bin/"$tool$2"
|
2019-10-13 11:18:29 +07:00
|
|
|
fi
|
|
|
|
done
|
2019-10-27 07:12:49 +07:00
|
|
|
|
2019-10-29 23:39:49 +07:00
|
|
|
if [ ! "$(apt-cache search php"$2"-psr)" ]; then
|
|
|
|
cd ~ && git clone --depth=1 https://github.com/jbboehr/php-psr.git
|
|
|
|
cd php-psr && sudo /usr/bin/phpize"$2"
|
|
|
|
./configure --with-php-config=/usr/bin/php-config"$2"
|
|
|
|
make -j2 && sudo make -j2 install
|
|
|
|
echo "extension=psr.so" >> "$ini_file"
|
|
|
|
fi
|
2019-10-27 07:12:49 +07:00
|
|
|
|
2019-12-22 09:31:06 +07:00
|
|
|
cd ~ && git clone --depth=1 -v https://github.com/phalcon/cphalcon.git -b "$1"
|
|
|
|
cd cphalcon/build && sudo ./install --phpize /usr/bin/phpize"$2" --php-config /usr/bin/php-config"$2"
|
|
|
|
echo "extension=phalcon.so" | sudo tee "$ini_dir/50-phalcon.ini"
|