Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boywijnmaalen/9185e8652342a1028f44893982367496 to your computer and use it in GitHub Desktop.
Save boywijnmaalen/9185e8652342a1028f44893982367496 to your computer and use it in GitHub Desktop.
install swoole for multiple PHP versions
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
@boywijnmaalen
Copy link
Author

boywijnmaalen commented Jun 17, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment