From 28fb2f6beaaf4489b48bd9b58cf0571e2a2e74ef Mon Sep 17 00:00:00 2001 From: lixworth Date: Fri, 9 Feb 2024 12:47:38 +0800 Subject: [PATCH] chore: Updated on 2024-02-09 12:47 --- .gitignore | 4 +- .../macos-php-8110.sh | 0 php-813.sh => archived/php-813.sh | 0 bin/update.sh | 5 ++ .../macos-php-8212-v5.sh | 0 php-8212-v5.sh => labs/php-8212-v5.sh | 0 .../setenv_macos_php82.sh | 0 setenv_php82.sh => labs/setenv_php82.sh | 0 macos-php-81.sh | 86 +++++++++++++++++++ php-81.sh | 80 +++++++++++++++++ 10 files changed, 174 insertions(+), 1 deletion(-) rename macos-php-8110.sh => archived/macos-php-8110.sh (100%) rename php-813.sh => archived/php-813.sh (100%) create mode 100644 bin/update.sh rename macos-php-8212-v5.sh => labs/macos-php-8212-v5.sh (100%) rename php-8212-v5.sh => labs/php-8212-v5.sh (100%) rename setenv_macos_php82.sh => labs/setenv_macos_php82.sh (100%) rename setenv_php82.sh => labs/setenv_php82.sh (100%) create mode 100644 macos-php-81.sh create mode 100644 php-81.sh diff --git a/.gitignore b/.gitignore index 5942aeb..2b3d582 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ tmp/ .idea/ -macos/ \ No newline at end of file +macos/ +macos-build/ +win-build/ \ No newline at end of file diff --git a/macos-php-8110.sh b/archived/macos-php-8110.sh similarity index 100% rename from macos-php-8110.sh rename to archived/macos-php-8110.sh diff --git a/php-813.sh b/archived/php-813.sh similarity index 100% rename from php-813.sh rename to archived/php-813.sh diff --git a/bin/update.sh b/bin/update.sh new file mode 100644 index 0000000..1e7d55d --- /dev/null +++ b/bin/update.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +git add . +git status +git commit -m "chore: Updated on $(date +%Y-%m-%d\ %H:%M)" +git push origin master \ No newline at end of file diff --git a/macos-php-8212-v5.sh b/labs/macos-php-8212-v5.sh similarity index 100% rename from macos-php-8212-v5.sh rename to labs/macos-php-8212-v5.sh diff --git a/php-8212-v5.sh b/labs/php-8212-v5.sh similarity index 100% rename from php-8212-v5.sh rename to labs/php-8212-v5.sh diff --git a/setenv_macos_php82.sh b/labs/setenv_macos_php82.sh similarity index 100% rename from setenv_macos_php82.sh rename to labs/setenv_macos_php82.sh diff --git a/setenv_php82.sh b/labs/setenv_php82.sh similarity index 100% rename from setenv_php82.sh rename to labs/setenv_php82.sh diff --git a/macos-php-81.sh b/macos-php-81.sh new file mode 100644 index 0000000..d960d62 --- /dev/null +++ b/macos-php-81.sh @@ -0,0 +1,86 @@ +echo "Mfuns build php with swoole and more extensions on macos" + +brew install wget autoconf automake libtool re2c bison pkg-config openssl libiconv oniguruma readline pcre2 + +base_dir=$(cd "$(dirname "$0")";pwd) + +sudo rm -rf ${base_dir}"/macos-build/php81" +sudo rm -rf /tmp/pecl/install +sudo rm -rf /tmp/pear/install +mkdir -p ${base_dir}"/macos-build/php81" +cd ${base_dir}"/macos-build/php81" || exit + +wget https://www.php.net/distributions/php-8.1.27.tar.gz || exit +tar -xzvf php-8.1.27.tar.gz + +cd "php-8.1.27" || exit + +./configure --prefix="${base_dir}"/macos-build/php81/php \ + --with-external-pcre=$(brew --prefix pcre2) \ + --with-openssl=$(brew --prefix openssl) \ + --with-iconv=$(brew --prefix libiconv) \ + --with-readline=$(brew --prefix readline) \ + --enable-mysqlnd \ + --with-pdo-mysql \ + --with-pdo-mysql=mysqlnd \ + --enable-bcmath \ + --enable-fpm \ + --enable-mbstring \ + --enable-phpdbg \ + --enable-shmop \ + --enable-sockets \ + --enable-sysvmsg \ + --enable-sysvsem \ + --enable-sysvshm \ + --with-zlib \ + --with-curl \ + --with-pear \ + --enable-pcntl +make -j $(sysctl -n hw.ncpu) +make install + +cp php.ini-development ${base_dir}/macos-build/php81/php/lib/php.ini +export PATH=${base_dir}"/macos-build/php81/php/bin:$PATH" + +cd "${base_dir}/macos-build/php81" || exit +wget https://github.com/swoole/swoole-src/archive/refs/tags/v5.1.2.zip +unzip v5.1.2.zip +cd "swoole-src-5.1.2" || exit +"${base_dir}"/macos-build/php81/php/bin/phpize + +ln -s $(brew --prefix pcre2)/include/pcre2.h "${base_dir}"/macos-build/php81/php/include/php/ext/pcre/pcre2.h +./configure \ + --enable-openssl \ + --with-openssl-dir=$(brew --prefix openssl) \ + --enable-http2 \ + --enable-swoole-curl \ + --enable-swoole-json \ + --enable-thread-context \ + --with-php-config=${base_dir}/macos-build/php81/php/bin/php-config + +make -j $(sysctl -n hw.ncpu) +make install + +cd "${base_dir}"/macos-build/php81 +wget http://pear.php.net/go-pear.phar +sudo ${base_dir}/macos-build/php81/php/bin/php go-pear.phar +sudo ${base_dir}/macos-build/php81/php/bin/pear config-get php_dir + +sudo ${base_dir}/macos-build/php81/php/bin/pecl channel-update pecl.php.net +sudo ${base_dir}/macos-build/php81/php/bin/pecl install redis + +echo "memory_limit=1G" >> "${base_dir}"/macos-build/php81/php/lib/php.ini +echo "opcache.enable_cli = 'On'" >> "${base_dir}"/macos-build/php81/php/lib/php.ini +echo "extension=redis.so" >> "${base_dir}"/macos-build/php81/php/lib/php.ini +echo "extension=swoole.so" >> "${base_dir}"/macos-build/php81/php/lib/php.ini +echo "swoole.use_shortname = 'Off'" >> "${base_dir}"/macos-build/php81/php/lib/php.ini + +"${base_dir}"/macos-build/php81/php/bin/php -v +"${base_dir}"/macos-build/php81/php/bin/php -m +"${base_dir}"/macos-build/php81/php/bin/php --ri swoole + +cd ${base_dir}/macos-build/php81 || exit +wget https://mirrors.aliyun.com/composer/composer.phar +"${base_dir}"/macos-build/php81/php/bin/php composer.phar + +echo -e "\033[42;37m Build Completed :).\033[0m\n" \ No newline at end of file diff --git a/php-81.sh b/php-81.sh new file mode 100644 index 0000000..1f20527 --- /dev/null +++ b/php-81.sh @@ -0,0 +1,80 @@ +echo "Mfuns build php with swoole and more extensions on ubuntu-22xx" + +base_dir=$(cd "$(dirname "$0")";pwd) + +sudo apt update +sudo apt upgrade +sudo apt install git wget autoconf automake bison build-essential curl flex \ + libtool libssl-dev libcurl4-openssl-dev libxml2-dev libreadline8 \ + libreadline-dev libsqlite3-dev libzip-dev openssl \ + pkg-config re2c sqlite3 zlib1g-dev libonig5 libonig-dev libsodium-dev \ + unzip + +sudo apt install libboost-all-dev +sudo rm -rf "${base_dir}/win-build/php81" +sudo rm -rf /tmp/pecl/install +sudo rm -rf /tmp/pear/install +mkdir -p "${base_dir}/win-build/php81" +cd "${base_dir}/win-build/php81" || exit +wget https://www.php.net/distributions/php-8.1.27.tar.gz || exit +tar -xzvf php-8.1.27.tar.gz +cd "php-8.1.27" || exit +./configure --prefix=${base_dir}/win-build/php81/php \ + --enable-mysqlnd \ + --with-pdo-mysql \ + --with-pdo-mysql=mysqlnd \ + --enable-bcmath \ + --enable-fpm \ + --enable-mbstring \ + --enable-phpdbg \ + --enable-shmop \ + --enable-sockets \ + --enable-sysvmsg \ + --enable-sysvsem \ + --enable-sysvshm \ + --enable-zip \ + --with-libzip=/usr/lib/x86_64-linux-gnu \ + --with-zlib \ + --with-curl \ + --with-pear \ + --with-openssl \ + --enable-pcntl \ + --with-readline +make -j 12 || exit +make install || exit +cp php.ini-development ${base_dir}/win-build/php81/php/lib/php.ini + +cd "${base_dir}/win-build/php81" || exit +wget https://mirror.ghproxy.com/https://github.com/swoole/swoole-src/archive/refs/tags/v5.1.2.zip +unzip v5.1.2.zip +cd "swoole-src-5.1.2" || exit +"${base_dir}"/win-build/php81/php/bin/phpize +./configure --enable-openssl --enable-http2 --enable-swoole-curl --enable-swoole-json --with-php-config=${base_dir}/win-build/php81/php/bin/php-config +make -s -j 12 +make install + +wget http://pear.php.net/go-pear.phar +sudo ${base_dir}/win-build/php81/php/bin/php go-pear.phar +sudo ${base_dir}/win-build/php81/php/bin/pear config-get php_dir + +sudo ${base_dir}/win-build/php81/php/bin/pecl channel-update pecl.php.net +#sudo ${base_dir}/win-build/php81/php/bin/pecl install zendopcache +sudo ${base_dir}/win-build/php81/php/bin/pecl install redis +sudo ${base_dir}/win-build/php81/php/bin/pecl install libsodium + +echo "memory_limit=1G" >> ${base_dir}/win-build/php81/php/lib/php.ini +echo "opcache.enable_cli = 'On'" >> ${base_dir}/win-build/php81/php/lib/php.ini +echo "extension=redis.so" >> ${base_dir}/win-build/php81/php/lib/php.ini +echo "extension=swoole.so" >> ${base_dir}/win-build/php81/php/lib/php.ini +echo "swoole.use_shortname = 'Off'" >> ${base_dir}/win-build/php81/php/lib/php.ini + +${base_dir}/win-build/php81/php/bin/php -v +${base_dir}/win-build/php81/php/bin/php -m +${base_dir}/win-build/php81/php/bin/php --ri swoole +${base_dir}/win-build/php81/php/bin/php --ri yasd + +cd ${base_dir}/win-build/php81 || exit +wget https://mirrors.aliyun.com/composer/composer.phar +${base_dir}/win-build/php81/php/bin/php composer.phar + +echo -e "\033[42;37m Build Completed :).\033[0m\n"