Last active
June 17, 2021 12:07
-
-
Save boywijnmaalen/9185e8652342a1028f44893982367496 to your computer and use it in GitHub Desktop.
install swoole for multiple PHP versions
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
for i in "7.0 7.1 7.2 7.3 7.4 8.0"; do | |
if [ ! -d "/tmp/swoole-src" ]; then | |
cd /tmp | |
git clone https://github.com/swoole/swoole-src.git | |
;fi | |
cd /tmp/swoole-src \ | |
if [ "${i}" = "7.0" ]; then | |
git checkout v4.3.6 | |
;elif [ "${i}" = "7.1" ]; then | |
git checkout v4.5.11 | |
# PHP 7.2, 7.3, 7.4 & 8.0 remain | |
;else | |
git checkout v4.6.7 | |
;fi | |
phpize${i} --clean | |
phpize${i} | |
if [ "${i}" = "7.0" ] || [ "${i}" = "7.1" ]; then | |
./configure --with-php-config=/usr/bin/php-config${i} \ | |
--enable-openssl \ | |
--with-openssl-dir=$(openssl version -d | cut -d' ' -f 2) \ | |
--enable-sockets \ | |
--enable-http2 \ | |
--enable-mysqlnd \ | |
--enable-swoole-debug | |
;else | |
./configure --with-php-config=/usr/bin/php-config${i} \ | |
--enable-openssl \ | |
--with-openssl-dir=$(openssl version -d | cut -d' ' -f 2) \ | |
--enable-sockets \ | |
--enable-http2 \ | |
--enable-mysqlnd \ | |
--enable-swoole-json \ | |
--enable-swoole-curl \ | |
--enable-swoole-debug | |
;fi | |
make | |
make install | |
# enable the swoole extension | |
echo '; configuration for php swoole module\n; priority=20\nextension=swoole' > /etc/php/${i}/mods-available/swoole.ini | |
phpenmod -v ${i} swoole | |
;done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I wrongly formatted the ./configure options, it should be like this;
./configure --with-php-config=/usr/bin/php-config${i} --enable-sockets=yes --enable-openssl=yes --enable-http2=yes --enable-mysqlnd=yes --enable-swoole-json=yes --enable-swoole-curl=yes --enable-swoole-debug=yes
Note: didn't update the gist itself for external reference sake