From d9d2ef8699404b4060afc984265a76463d0160e7 Mon Sep 17 00:00:00 2001 From: "del.xiong" Date: Thu, 28 Jun 2018 12:53:28 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E4=B8=8BSTRICT=5FMODE=E4=B8=8D=E5=8F=AF?= =?UTF-8?q?=E7=94=A8=E9=97=AE=E9=A2=98,=20=E6=B7=BB=E5=8A=A0STRICT=5FMODE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php_screw_plus.c | 7 ++++++- php_screw_plus.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/php_screw_plus.c b/php_screw_plus.c index 9c2798f..2e6d827 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -58,7 +58,12 @@ FILE *pm9screw_ext_fopen(FILE *fp) } fp = tmpfile(); - fwrite(datap, datalen, 1, fp); + if (datalen > 0) { + fwrite(datap, datalen, 1, fp); + } else { + fwrite(STRICT_MODE_ERROR_MESSAGE, strlen(STRICT_MODE_ERROR_MESSAGE), 1, fp); + } + free(datap); rewind(fp); diff --git a/php_screw_plus.h b/php_screw_plus.h index a5d87b5..240ffdf 100644 --- a/php_screw_plus.h +++ b/php_screw_plus.h @@ -2,4 +2,5 @@ //如果只允许执行加过密的php文件 设置STRICT_MODE为1 //set STRICT_MODE to 1 if you only want the crypted php files to be executed #define STRICT_MODE 0 +#define STRICT_MODE_ERROR_MESSAGE "ACCESS DENIED" const int maxBytes = 1024*1024*2; \ No newline at end of file From 9539b1fc9a889b4b0ebdfb5be29bf9c2380c9065 Mon Sep 17 00:00:00 2001 From: del Date: Sat, 30 Jun 2018 00:14:38 +0800 Subject: [PATCH 02/12] =?UTF-8?q?PHP=5FNEW=5FEXTENSION=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=E6=9B=B4=E6=96=B0,=20=E5=85=BC=E5=AE=B9?= =?UTF-8?q?=E6=96=B0=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.m4 b/config.m4 index ca499ab..f8e25a4 100644 --- a/config.m4 +++ b/config.m4 @@ -14,5 +14,5 @@ dnl Make sure that the comment is aligned: if test "$PHP_php_screw" != "no"; then dnl Action.. - PHP_EXTENSION(php_screw_plus, $ext_shared) + PHP_NEW_EXTENSION(php_screw_plus, php_screw_plus.c, $ext_shared) fi From cb42eeb0c76ae938432ac8346a47e4c7a0acf4be Mon Sep 17 00:00:00 2001 From: del Date: Sat, 30 Jun 2018 00:31:34 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E6=B7=BB=E5=8A=A0DOCKER=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E6=9E=84=E5=BB=BA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker_build/php7.1_alpine/Dockerfile | 20 ++ docker_build/php7.1_alpine/README.md | 9 + .../Dockerfile | 221 ++++++++++++++++++ .../php7.2.6-redis-memcached-swoole/README.md | 13 ++ 4 files changed, 263 insertions(+) create mode 100644 docker_build/php7.1_alpine/Dockerfile create mode 100644 docker_build/php7.1_alpine/README.md create mode 100644 docker_build/php7.2.6-redis-memcached-swoole/Dockerfile create mode 100644 docker_build/php7.2.6-redis-memcached-swoole/README.md diff --git a/docker_build/php7.1_alpine/Dockerfile b/docker_build/php7.1_alpine/Dockerfile new file mode 100644 index 0000000..07202e3 --- /dev/null +++ b/docker_build/php7.1_alpine/Dockerfile @@ -0,0 +1,20 @@ +FROM alpine:3.7 + +RUN echo "https://mirrors.aliyun.com/alpine/v3.7/main/" > /etc/apk/repositories \ +&& echo "https://mirrors.aliyun.com/alpine/v3.7/community/" >> /etc/apk/repositories \ +&& apk add --update --no-cache rsyslog runit dcron curl wget bash rsync nodejs tzdata \ +&& apk add php7 php7-fpm php7-gd php7-redis \ +php7-opcache php7-pdo php7-pdo_mysql php7-mbstring php7-json \ +php7-mcrypt php7-curl php7-ctype php7-zip php7-xml php7-simplexml \ +php7-xmlreader php7-xmlwriter php7-phar php7-fileinfo + +RUN apk add --virtual .build-deps build-base php7-dev zlib-dev && \ +cd / && \ +wget https://codeload.github.com/del-xiong/screw-plus/zip/master && \ +unzip master && \ +cd /screw-plus-master && \ +phpize && \ +./configure --with-php-config=php-config && \ +make && make install && \ +cd tools && make && \ +apk del .build-deps \ No newline at end of file diff --git a/docker_build/php7.1_alpine/README.md b/docker_build/php7.1_alpine/README.md new file mode 100644 index 0000000..1df51ce --- /dev/null +++ b/docker_build/php7.1_alpine/README.md @@ -0,0 +1,9 @@ +## alpine+php7.1+screw plus +``` +@author QQ群友 chunhui.hu +@size 88.6MB +拉取: docker pull pastyouth/php-screw-plus:php7.1_alpine +运行方法: docker run -p ... -v ... +构建完成后删除了screw plus编译环境, 建议外部挂载程序 +若要内部重新编译screw plus, 可注释Dockerfile最后一行 apk del..., 构建镜像成功后可在容器内部编译, 容量会上升至300MB左右 +``` \ No newline at end of file diff --git a/docker_build/php7.2.6-redis-memcached-swoole/Dockerfile b/docker_build/php7.2.6-redis-memcached-swoole/Dockerfile new file mode 100644 index 0000000..f533842 --- /dev/null +++ b/docker_build/php7.2.6-redis-memcached-swoole/Dockerfile @@ -0,0 +1,221 @@ +FROM centos + +# 安装工具 +RUN cd / && yum install -y epel-release && \ +yum install -y wget vi gcc gcc-c++ autoconf libjpeg libcurl libcurl-devel libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \ +zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel \ +libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt libxslt-devel libevent-devel \ +iconv libmcrypt libmcrypt-devel libicu-devel re2c bison bzip2 bzip2-devel unzip; yum clean all && \ +ldconfig + +# 安装libzip的安装工具cmake https://cmake.org/files/ +RUN cd / && wget https://cmake.org/files/v3.12/cmake-3.12.0-rc1.tar.gz && \ +tar -zxvf cmake-3.12.0-rc1.tar.gz && \ +cd /cmake-3.12.0-rc1 && \ +./configure && make && make install && \ +rm -f /cmake-3.12.0-rc1.tar.gz && \ +rm -rf /cmake-3.12.0-rc1 + +# 安装libzip库 https://libzip.org/download/ +RUN cd / && wget https://libzip.org/download/libzip-1.5.1.tar.gz && \ +tar -xf libzip-1.5.1.tar.gz && \ +cd /libzip* && \ +mkdir build && cd build && cmake .. && make && make install && \ +rm -f /libzip-1.5.1.tar.gz && \ +rm -rf /libzip-1.5.1 + +# 安装ICU库(为了安装intl扩展 owncloud用到) +RUN cd / && wget http://download.icu-project.org/files/icu4c/62rc/icu4c-62rc-src.tgz && \ +tar xf icu4c-62rc-src.tgz && \ +cd icu/source && \ +mkdir /usr/local/icu && \ +./configure --prefix=/usr/local/icu && \ +make && make install && \ +rm -f /icu4c-62rc-src.tgz && \ +rm -rf /icu + +# 下载并解压源码包 +RUN cd / && wget http://jp2.php.net/distributions/php-7.2.6.tar.gz && \ +tar -zxvf php-7.2.6.tar.gz +# 编译安装 +RUN cd /php-7.2.6 && ./configure --prefix=/usr/local/php \ + --with-curl \ + --with-freetype-dir \ + --with-jpeg-dir \ + --with-gd \ + --with-gettext \ + --with-iconv-dir \ + --with-kerberos \ + --with-libdir=lib64 \ + --with-libxml-dir \ + --with-mysqli \ + --with-openssl \ + --with-pcre-regex \ + --with-pdo-mysql \ + --with-pdo-sqlite \ + --with-pear \ + --with-png-dir \ + --with-xmlrpc \ + --with-xsl \ + --with-zlib \ + --with-mhash \ + --with-libzip \ + --enable-fpm \ + --enable-bcmath \ + --enable-libxml \ + --enable-inline-optimization \ + --enable-mbregex \ + --enable-mbstring \ + --enable-opcache \ + --enable-pcntl \ + --enable-shmop \ + --enable-soap \ + --enable-sockets \ + --enable-sysvsem \ + --enable-xml \ + --enable-zip \ + --enable-simplexml \ + --enable-intl && \ +make && make install && \ +cp php.ini-production /usr/local/php/lib/php.ini && \ +cp sapi/fpm/init.d.php-fpm /usr/local/php/etc/php-fpm && \ +sed -i 's/ --daemonize//g' /usr/local/php/etc/php-fpm && \ +chmod +x /usr/local/php/etc/php-fpm && \ +cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf && \ +cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf && \ +sed -i 's/^;daemonize = yes/daemonize = no/g' /usr/local/php/etc/php-fpm.conf && \ +sed -i 's/^listen = 127\.0\.0\.1\:9000/listen = 9000/g' /usr/local/php/etc/php-fpm.d/www.conf && \ +rm -rf /php-7.2.6 && \ +rm -f /php-7.2.6.tar.gz + + +#下载mcrypt扩展 +RUN cd / && wget http://pecl.php.net/get/mcrypt-1.0.1.tgz && \ +tar -zxvf mcrypt-1.0.1.tgz && \ +cd mcrypt-1.0.1 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && make install && \ +echo "extension_dir=/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/">>/usr/local/php/lib/php.ini && \ +echo "extension=mcrypt.so">>/usr/local/php/lib/php.ini && \ +rm -rf /mcrypt-1.0.1 && \ +rm -f /mcrypt-1.0.1.tgz + +# 安装memcached 依赖库igbinary http://pecl.php.net/package/igbinary +RUN cd / && wget http://pecl.php.net/get/igbinary-2.0.6.tgz && \ +tar -zxvf igbinary-2.0.6.tgz && \ +cd igbinary-2.0.6 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && make install && \ +echo "extension=igbinary.so">>/usr/local/php/lib/php.ini && \ +rm -f /igbinary-2.0.6.tgz && \ +rm -rf /igbinary-2.0.6 + +# 安装memcached 依赖库msgpack http://pecl.php.net/package/msgpack +RUN cd / && wget http://pecl.php.net/get/msgpack-2.0.2.tgz && \ +tar -zxvf msgpack-2.0.2.tgz && \ +cd msgpack-2.0.2 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && make install && \ +echo "extension=msgpack.so">>/usr/local/php/lib/php.ini && \ +rm -f /msgpack-2.0.2.tgz && \ +rm -rf /msgpack-2.0.2 + +# 安装redis依赖库hiredis https://github.com/redis/hiredis/releases +RUN cd / && wget https://github.com/redis/hiredis/archive/v0.13.3.tar.gz && \ +tar -zxvf v0.13.3.tar.gz && \ +cd hiredis-0.13.3/ && \ +make && make install && \ +ldconfig && \ +rm -f /v0.13.3.tar.gz && \ +rm -rf /hiredis-0.13.3 + +# 安装redis https://github.com/phpredis/phpredis/releases +RUN cd / && wget https://github.com/phpredis/phpredis/archive/4.1.0RC1.tar.gz && \ +tar -zxvf 4.1.0RC1.tar.gz && \ +cd phpredis-4.1.0RC1/ && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && \ +make install && \ +echo "extension=redis.so">>/usr/local/php/lib/php.ini && \ +rm -f /4.1.0RC1.tar.gz && \ +rm -rf /phpredis-4.1.0RC1 + +# 安装 http2依赖库 nghttp2 https://github.com/nghttp2/nghttp2/releases/ +RUN cd / && wget https://github.com/nghttp2/nghttp2/releases/download/v1.32.0/nghttp2-1.32.0.tar.gz && \ +tar -zxvf nghttp2-1.32.0.tar.gz && \ +cd nghttp2-1.32.0/ && \ +./configure && \ +make && make install && \ +rm -f /nghttp2-1.32.0.tar.gz && \ +rm -rf /nghttp2-1.32.0 + +# 安装swoole https://github.com/swoole/swoole-src/releases +RUN cd / && wget https://github.com/swoole/swoole-src/archive/v4.0.0.tar.gz && \ +tar -zxvf v4.0.0.tar.gz && \ +cd swoole-src-4.0.0/ && \ +/usr/local/php/bin/phpize && \ +./configure --enable-sockets --enable-openssl --enable-http2 --enable-async-redis --enable-timewheel --enable-mysqlnd --enable-coroutine --with-php-config=/usr/local/php/bin/php-config && \ +make clean && make && make install && \ +echo "extension=swoole.so">>/usr/local/php/lib/php.ini && \ +echo "/usr/local/lib">>/etc/ld.so.conf && \ +ldconfig && \ +rm -f /v4.0.0.tar.gz && \ +rm -rf /swoole-src-4.0.0 + +# 安装memcached 依赖库 libmemcached https://launchpad.net/libmemcached/ +RUN cd / && wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz && \ +tar -zxvf libmemcached-1.0.18.tar.gz && \ +cd libmemcached-1.0.18 && \ +./configure --prefix=/usr/local/libmemcached && \ +make && make install && \ +rm -f /libmemcached-1.0.18.tar.gz && \ +rm -rf /libmemcached-1.0.18 + +# 安装http://pecl.php.net/package/memcached +RUN cd / && wget http://pecl.php.net/get/memcached-3.0.4.tgz && \ +tar -zxvf memcached-3.0.4.tgz && \ +cd memcached-3.0.4 && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --enable-memcached-igbinary \ +--enable-memcached-json --enable-memcached-msgpack && \ +make && make install && \ +echo "extension=memcached.so">>/usr/local/php/lib/php.ini && \ +rm -f /memcached-3.0.4.tgz && \ +rm -rf /memcached-3.0.4 + +# 安装 php screw plus https://codeload.github.com/del-xiong/screw-plus/zip/master +RUN cd / && wget https://codeload.github.com/del-xiong/screw-plus/zip/master && \ +unzip master && \ +cd /screw-plus-master && \ +/usr/local/php/bin/phpize && \ +./configure --with-php-config=/usr/local/php/bin/php-config && \ +make && \ +cp /screw-plus-master/modules/php_screw_plus.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/ && \ +echo "extension=php_screw_plus.so">>/usr/local/php/lib/php.ini && \ +cd /screw-plus-master/tools && \ +make && \ +rm -f /master +#rm -rf /screw-plus-master + +# 创建好挂载目录 +RUN mkdir -p /data/php/log && mkdir -p /data/nginx/www + +# 设置时区 +RUN cp -f /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone + +# 启动php服务 +RUN chmod +x /usr/local/php/etc/php-fpm && /usr/local/php/etc/php-fpm start & + +# 设置环境变量 +ENV PATH=$PATH:/usr/local/php/etc:/usr/local/php/bin + +#设置生成容器时需要执行的脚本 +#ENTRYPOINT ["/usr/local/php/sbin/php-fpm"] +CMD [ "php-fpm", "start" ] + +#开放9000端口 +EXPOSE 9000 diff --git a/docker_build/php7.2.6-redis-memcached-swoole/README.md b/docker_build/php7.2.6-redis-memcached-swoole/README.md new file mode 100644 index 0000000..d3283f8 --- /dev/null +++ b/docker_build/php7.2.6-redis-memcached-swoole/README.md @@ -0,0 +1,13 @@ +## screw plus + php7.2.6 + redis + memcached + swoole +``` +@author QQ群友 今日在线 +@size 800MB +``` +``` +// 拉取: +docker pull pastyouth/php-screw-plus:php7.2.6-redis-memcached-swoole +// 运行: +docker run -p 9000:9000 -name web1 -v /data:/data/nginx/www screw-plus:php7.2.6-redis-memcached-swoole +// 进入容器 +docker exec -it web1 /bin/sh +``` \ No newline at end of file From 7709d0f69139db2983fe14a1cdadce97757aa203 Mon Sep 17 00:00:00 2001 From: del Date: Thu, 9 May 2019 23:53:35 +0800 Subject: [PATCH 04/12] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=A8=E6=9F=90?= =?UTF-8?q?=E4=BA=9Blinux=E7=B3=BB=E7=BB=9F=E7=94=B1=E4=BA=8Edirent?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=88=A4=E6=96=AD=E6=96=87=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=AF=BC=E8=87=B4=E7=9A=84=E5=8A=A0=E8=A7=A3=E5=AF=86?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/screw.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/screw.c b/tools/screw.c index 557338f..44c0619 100644 --- a/tools/screw.c +++ b/tools/screw.c @@ -64,6 +64,7 @@ void scanRoot(char *path) int i; int l = 0; hP=opendir(path); + struct stat stat_buf; if(hP == NULL) return; while (NULL != (dir=readdir(hP))) @@ -75,14 +76,15 @@ void scanRoot(char *path) memset(curPath,0,sizeof(curPath)); strcat(curPath,path); strcat(curPath,dir->d_name); - if(dir->d_type == 4){ + stat(curPath, &stat_buf); + // if it is a folder + if (S_ISDIR(stat_buf.st_mode)) { if(curPath[l-1] != '/') strcat(curPath,"/"); scanRoot(curPath); - }else - if(isPHP(dir->d_name) && dir->d_type == 8){ - screw_work(curPath); - } + } else if (isPHP(dir->d_name)) { + screw_work(curPath); + } } } From c3966716205865c6f7994635ac4f9bd7030ebea0 Mon Sep 17 00:00:00 2001 From: Shaowei Pu <18391791+m9rco@users.noreply.github.com> Date: Wed, 13 Nov 2019 16:11:08 +0800 Subject: [PATCH 05/12] Update php_screw_plus.c Conflict with the phar extension, skip to the phar file decryption operation --- php_screw_plus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/php_screw_plus.c b/php_screw_plus.c index 2e6d827..65f437a 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -76,7 +76,11 @@ ZEND_API zend_op_array *pm9screw_compile_file(zend_file_handle *file_handle, int { FILE *fp; char fname[32]; - + + if (!file_handle || !file_handle->filename || strstr(file_handle->filename, ".phar") || strstr(file_handle->filename, "phar://")) { + f return org_compile_file(file_handle, type); + } + memset(fname, 0, sizeof fname); if (zend_is_executing(TSRMLS_C)) { if (get_active_function_name(TSRMLS_C)) { From 7a9ff7f2e687df11eb93eae0445c64337f27cb2e Mon Sep 17 00:00:00 2001 From: Shaowei Pu <18391791+m9rco@users.noreply.github.com> Date: Wed, 13 Nov 2019 17:58:22 +0800 Subject: [PATCH 06/12] Update php_screw_plus.c --- php_screw_plus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_screw_plus.c b/php_screw_plus.c index 65f437a..bb3c6c2 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -78,7 +78,7 @@ ZEND_API zend_op_array *pm9screw_compile_file(zend_file_handle *file_handle, int char fname[32]; if (!file_handle || !file_handle->filename || strstr(file_handle->filename, ".phar") || strstr(file_handle->filename, "phar://")) { - f return org_compile_file(file_handle, type); + return org_compile_file(file_handle, type); } memset(fname, 0, sizeof fname); From c8f08d19848d345dff40737d76105b6431505469 Mon Sep 17 00:00:00 2001 From: del Date: Sun, 1 Dec 2019 12:33:12 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7=20=E5=B0=81=E5=AD=98=E5=8E=86=E5=8F=B2=E7=89=88?= =?UTF-8?q?=E6=9C=AC=20add=20version=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php_screw_plus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/php_screw_plus.c b/php_screw_plus.c index bb3c6c2..e01aaa2 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -133,6 +133,7 @@ PHP_MINFO_FUNCTION(php_screw_plus) { php_info_print_table_start(); php_info_print_table_header(2, "php_screw_plus support", "enabled"); + php_info_print_table_header(2, "php_screw_plus version", "0.11"); php_info_print_table_end(); } From b69fd4fbb9240e730320144af68b0522b1a7dcb4 Mon Sep 17 00:00:00 2001 From: del xiong Date: Thu, 2 Jul 2020 20:03:45 +0800 Subject: [PATCH 08/12] =?UTF-8?q?=E5=85=BC=E5=AE=B9php7.4=E7=A7=BB?= =?UTF-8?q?=E9=99=A4ZEND=5FHANDLE=5FFD=E4=BA=86=E5=AE=9A=E4=B9=89=20ifdef?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- php_screw_plus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/php_screw_plus.c b/php_screw_plus.c index e01aaa2..f2f0264 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -103,7 +103,9 @@ ZEND_API zend_op_array *pm9screw_compile_file(zend_file_handle *file_handle, int } if (file_handle->type == ZEND_HANDLE_FP) fclose(file_handle->handle.fp); - if (file_handle->type == ZEND_HANDLE_FD) close(file_handle->handle.fd); + #ifdef ZEND_HANDLE_FD + if (file_handle->type == ZEND_HANDLE_FD) close(file_handle->handle.fd); + #endif file_handle->handle.fp = pm9screw_ext_fopen(fp); file_handle->type = ZEND_HANDLE_FP; From 0f9ef3c2c95bc6558427dc1843b0c430196b5a4c Mon Sep 17 00:00:00 2001 From: Del Xiong Date: Thu, 2 Jul 2020 20:12:56 +0800 Subject: [PATCH 09/12] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 41d5f59..b0eb32d 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ o4芉!#漫}耑-??朒漜垃 ### 使用方法: 1. 下载本程序并解压到某个目录 2. 在screw plus目录中执行php bin中的phpize自动生成扩展所需文件(如果你的php里没有可以去官网下载) -3. 执行./configure --with-php=config=[php config path] 进行配置,[php config path]是你的php-config的绝对路径 +3. 执行./configure --with-php-config=[php config path] 进行配置,[php config path]是你的php-config的绝对路径 4. 修改php_screw_plus.h中的CAKEY,改为一个你认为安全的字符串 5. 执行make生成扩展 modules/php_screw_plus.so 6. 把扩展路径加入php.ini中 重启php @@ -65,4 +65,4 @@ o4芉!#漫}耑-??朒漜垃 ``` 表示解密web目录的所有php文件 -现在可以访问php文件,如果前面没有发生错误,应该可以正常执行了。 \ No newline at end of file +现在可以访问php文件,如果前面没有发生错误,应该可以正常执行了。 From 7e501686e2f71be927f5b19b6ac5f7565304c29f Mon Sep 17 00:00:00 2001 From: Del Xiong Date: Tue, 12 Apr 2022 13:07:57 +0800 Subject: [PATCH 10/12] =?UTF-8?q?php8=E7=BC=96=E8=AF=91=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=20add=20supports=20for=20php8.*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ php_screw_plus.c | 2 +- php_screw_plus.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0eb32d..639d5e3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@ oschina http://git.oschina.net/splot/php-screw-plus **交流QQ群 530887505** +支持版本: php 5.6-8.1 +supported versions: php 5.6-8.1 + ### 简述 - 2016/08/13更新:给screw增加批量解密功能 - 2016/06/27更新:增加了STRICT_MODE,如果只允许服务器执行加过密的php文件,设置php_screw_plus.h STRICT_MODE为1(set STRICT_MODE to 1 if you only want the crypted php files to be executed),此举可防止黑客或其他人执行任意php文件。 diff --git a/php_screw_plus.c b/php_screw_plus.c index f2f0264..02ce5ad 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -70,7 +70,7 @@ FILE *pm9screw_ext_fopen(FILE *fp) return fp; } -ZEND_API zend_op_array *(*org_compile_file)(zend_file_handle *file_handle, int type TSRMLS_DC); +ZEND_API zend_op_array *(*org_compile_file)(zend_file_handle *file_handle, int TSRMLS_DC); ZEND_API zend_op_array *pm9screw_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC) { diff --git a/php_screw_plus.h b/php_screw_plus.h index 240ffdf..5d74562 100644 --- a/php_screw_plus.h +++ b/php_screw_plus.h @@ -3,4 +3,7 @@ //set STRICT_MODE to 1 if you only want the crypted php files to be executed #define STRICT_MODE 0 #define STRICT_MODE_ERROR_MESSAGE "ACCESS DENIED" +#define TSRMLS_C +#define TSRMLS_CC +#define TSRMLS_DC const int maxBytes = 1024*1024*2; \ No newline at end of file From 49a91d4c90cc51f100b14069b6a77239c45021c0 Mon Sep 17 00:00:00 2001 From: del Date: Tue, 21 Jun 2022 23:43:51 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E8=A7=A3=E5=AF=86=E6=97=B6=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=86=85=E5=AD=98=E6=A0=B9=E6=8D=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=9C=9F=E5=AE=9E=E5=A4=A7=E5=B0=8F=E7=94=B3=E8=AF=B7=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++-- php_screw_plus.c | 2 +- php_screw_plus.h | 3 +-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 639d5e3..af5ab92 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ # php screw plus +### 20220621 screw plus不再进行维护,对加密运行有需求的朋友可转向screw opcode,基于opcode的加密,可为php提供更安全、高效的加密运行环境 + +### screw opcode https://github.com/del-xiong/screw-opcode + +-------------------------------------- +-------------------------------------- + github https://github.com/del-xiong/screw-plus oschina http://git.oschina.net/splot/php-screw-plus @@ -42,14 +49,14 @@ define('CONFIG_UC', './config/config_ucenter.php'); ``` 加密后: ``` -a57f658413a1a06742855 2盆閡?煉A%匛If???骗叴 聒诧l膢*C??禳颲??蜁爨t?犡c?毉TC誥1%-?q1|9B鑐/, 擤`M柼Vd`q?.r:婺Xo廰損??軋?訍祔tq忄,?uj*坵括罸 ???? -a?A?硾亀浑湀(J蒷驗I榮CRd?~踾T? ~r刜-7嗎?炐z(9.? +a57f658413a1a06742855 2盆閡?煉A%匛If???骗叴 聒诧l膢*C??禳颲??蜁爨t?犡c?毉TC誥1%-?q1|9B鑐/, 擤`M柼Vd`q?.r:婺Xo廰損??軋?訍祔tq忄,?uj*坵括罸 ???? -a?A?硾亀浑湀(J蒷驗I榮CRd?~踾T? ~r刜-7嗎?炐z(9.? t0+c箝侶Y漟W)?1?吲i碀 ^P;y伙異战耠甿F夺9瓟愕簎嵾*B續酉??朴瀹)輤qq疏?Ρo??_族嬇R緬?|?筹誀KT钄籘79薗勜PhS恺堨猞?j_)及B盭w??吠辱c?ra?敺奓嵑$j鹳啎` ?秽⒗P鮡姩到 ?羮?I?'湣挸]Ι話宛Lr 驜腢瀶k辖K姲眯J噤N?g喴邃彛¢梴k~?1丛疫葘齍 o4芉!#漫}耑-??朒漜垃 芎wQa?)Dx聢D?w*鬿cケ:嬺郠椦TY魷 FJ??觺杠B`9€X]┚呿4?k娤?豯v?9??\螐廱鲟`漬\F?#假 +蒈Z霃"鮼昖靚 6簝hS歉??O低盖??禜?啀Fm=???盾殝斺娎?A≡m-SWg祫a廠睛hV')/ぐE??友?徛7gU勭u脘愨赔?抇/剡飃I-?穟?E愧憂=Bp=楱殓\d膛*鱦鷂?鞦驲藛W;?疉陛菔鐰?eYM葼乛飌间∫曖>cケ:嬺郠椦TY魷 FJ??觺杠B`9€X]┚呿4?k娤?豯v?9??\螐廱鲟`漬\F?#假 ?S阮??8邂璟襹B跷沯僯{¬UI憤 ``` ### 使用方法: diff --git a/php_screw_plus.c b/php_screw_plus.c index 02ce5ad..e6f1d13 100644 --- a/php_screw_plus.c +++ b/php_screw_plus.c @@ -40,7 +40,7 @@ FILE *pm9screw_ext_fopen(FILE *fp) memset(lenBuf, 0, 16); fstat(fileno(fp), &stat_buf); datalen = stat_buf.st_size; - datap = (char*)malloc(maxBytes); + datap = (char*)malloc(datalen + 16); memset(datap, 0, sizeof(datap)); fread(datap, datalen, 1, fp); fclose(fp); diff --git a/php_screw_plus.h b/php_screw_plus.h index 5d74562..e1ffe74 100644 --- a/php_screw_plus.h +++ b/php_screw_plus.h @@ -5,5 +5,4 @@ #define STRICT_MODE_ERROR_MESSAGE "ACCESS DENIED" #define TSRMLS_C #define TSRMLS_CC -#define TSRMLS_DC -const int maxBytes = 1024*1024*2; \ No newline at end of file +#define TSRMLS_DC \ No newline at end of file From 0adb2fea812051f7ef20199339dafb5b0964828a Mon Sep 17 00:00:00 2001 From: del Date: Sat, 25 Jun 2022 08:27:15 +0800 Subject: [PATCH 12/12] =?UTF-8?q?=E7=A7=BB=E9=99=A4tools=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E4=B8=ADmaxBytes=20replace=20maxBytes=20with=20the=20real=20fi?= =?UTF-8?q?le=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/screw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/screw.c b/tools/screw.c index 44c0619..48e976a 100644 --- a/tools/screw.c +++ b/tools/screw.c @@ -118,7 +118,7 @@ void screw_decrypt(char *file) { memset(lenBuf, 0, 16); fstat(fileno(fp), &stat_buf); datalen = stat_buf.st_size; - datap = (char*)malloc(maxBytes); + datap = (char*)malloc(datalen); memset(datap, 0, sizeof(datap)); fread(datap, datalen, 1, fp); fclose(fp); @@ -172,7 +172,7 @@ void screw_encrypt(char *file) { fstat(fileno(fp), &stat_buf); datalen = stat_buf.st_size; - datap = (char*)malloc(maxBytes); + datap = (char*)malloc(datalen); memset(datap, 0, sizeof(datap)); fread(datap, datalen, 1, fp); fclose(fp);