From d959815f5ea7a01ab77cc0395d1f2d6df43b8f0a Mon Sep 17 00:00:00 2001 From: kuaifan Date: Tue, 27 Jul 2021 21:20:18 +0800 Subject: [PATCH] use php8.0 --- app/Module/Base.php | 2 +- cmd | 2 +- composer.json | 2 +- docker-compose.yml | 2 +- docker/php/php.Dockerfile | 41 +++++++------ docker/php/php.ini | 119 +++++++++++++++++++------------------- 6 files changed, 86 insertions(+), 82 deletions(-) diff --git a/app/Module/Base.php b/app/Module/Base.php index b3fe5159..ea9b645b 100755 --- a/app/Module/Base.php +++ b/app/Module/Base.php @@ -877,7 +877,7 @@ class Base return false; } else { list($year, $month, $day) = $strArr; - if (checkdate($month, $day, $year)) { + if (checkdate(intval($month), intval($day), intval($year))) { return true; } else { return false; diff --git a/cmd b/cmd index f2bedaca..d27d4214 100755 --- a/cmd +++ b/cmd @@ -131,7 +131,7 @@ if [ $# -gt 0 ];then supervisorctl_restart php elif [[ "$1" == "uninstall" ]]; then shift 1 - read -rp "确定要卸载(含:删除容器、数据库、日志)吗?(y/N): " uninstall + read -rp "确定要卸载(含:删除容器、数据库、日志)吗?(y/n): " uninstall [[ -z ${uninstall} ]] && uninstall="N" case $uninstall in [yY][eE][sS] | [yY]) diff --git a/composer.json b/composer.json index 5f0f9b4c..5156e792 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ ], "license": "MIT", "require": { - "php": "^7.3|^8.0", + "php": "^8.0", "ext-curl": "*", "ext-gd": "*", "ext-json": "*", diff --git a/docker-compose.yml b/docker-compose.yml index 5acd91a6..89bfd8f3 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: php: container_name: "dooteak-php-${DOCKER_ID}" - image: "kuaifan/phpdootask" + image: "kuaifan/dootaskphp:8.0" volumes: - /var/run/docker.sock:/var/run/docker.sock - ./docker/crontab/crontab.conf:/etc/supervisor/conf.d/crontab.conf diff --git a/docker/php/php.Dockerfile b/docker/php/php.Dockerfile index 470f20eb..91f4b21d 100644 --- a/docker/php/php.Dockerfile +++ b/docker/php/php.Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$TARGETPLATFORM phpswoole/swoole:php7.4 +FROM --platform=$TARGETPLATFORM phpswoole/swoole:php8.0 # Installation dependencies and PHP core extensions RUN apt-get update \ @@ -23,28 +23,33 @@ RUN apt-get update \ libfreetype6-dev \ inotify-tools \ sshpass \ - cron \ - && echo "* * * * * sh /var/www/docker/crontab/crontab.sh" > /tmp/crontab \ - && crontab /tmp/crontab \ - && rm -rf /tmp/crontab \ - && curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \ - && apt-get -y install nodejs \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install pdo_mysql gd pcntl zip \ - && echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list \ + cron + +RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - \ + && apt-get -y install nodejs + +RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install pdo_mysql gd pcntl zip + +RUN mkdir -p /usr/src/php/ext/redis \ + && curl -L https://github.com/phpredis/phpredis/archive/5.3.2.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \ + && echo 'redis' >> /usr/src/php-available-exts \ + && docker-php-ext-install redis + +RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list \ && echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" >> /etc/apt/sources.list \ && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367 \ && apt-get update \ - && apt-get install -y wireguard openresolv ansible openssh-client \ - && mkdir -p /usr/src/php/ext/redis \ - && curl -L https://github.com/phpredis/phpredis/archive/5.3.2.tar.gz | tar xvz -C /usr/src/php/ext/redis --strip 1 \ - && echo 'redis' >> /usr/src/php-available-exts \ - && docker-php-ext-install redis \ - && rm -r /var/lib/apt/lists/* + && apt-get install -y wireguard openresolv ansible openssh-client + +RUN echo "* * * * * sh /var/www/docker/crontab/crontab.sh" > /tmp/crontab \ + && crontab /tmp/crontab \ + && rm -rf /tmp/crontab + +RUN rm -r /var/lib/apt/lists/* -# Set the WORKDIR to /var/www so all following commands run in /var/www WORKDIR /var/www # docker buildx create --use -# docker buildx build --platform linux/arm64,linux/amd64 -t kuaifan/phpdootask --push -f ./php.Dockerfile . +# docker buildx build --platform linux/arm64,linux/amd64 -t kuaifan/dootaskphp:8.0 --push -f ./php.Dockerfile . # 需要 docker login 到 docker hub, 用户名 (docker id): kuaifan diff --git a/docker/php/php.ini b/docker/php/php.ini index 2ee51dc0..1636beaa 100644 --- a/docker/php/php.ini +++ b/docker/php/php.ini @@ -83,11 +83,12 @@ ; development version only in development environments, as errors shown to ; application users can inadvertently leak otherwise secure information. -; This is the php.ini-development INI file. +; This is the php.ini-production INI file. ;;;;;;;;;;;;;;;;;;; ; Quick Reference ; ;;;;;;;;;;;;;;;;;;; + ; The following are all the settings which are different in either the production ; or development versions of the INIs with respect to PHP's default behavior. ; Please see the actual settings later in the document for more details as to why @@ -99,12 +100,12 @@ ; Production Value: Off ; display_startup_errors -; Default Value: Off +; Default Value: On ; Development Value: On ; Production Value: Off ; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Default Value: E_ALL ; Development Value: E_ALL ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT @@ -153,6 +154,16 @@ ; Development Value: "GPCS" ; Production Value: "GPCS" +; zend.exception_ignore_args +; Default Value: Off +; Development Value: Off +; Production Value: On + +; zend.exception_string_param_max_len +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 + ;;;;;;;;;;;;;;;;;;;; ; php.ini Options ; ;;;;;;;;;;;;;;;;;;;; @@ -352,20 +363,30 @@ zend.enable_gc = On ; If enabled, scripts may be written in encodings that are incompatible with ; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such ; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off ;zend.multibyte = Off ; Allows to set the default encoding for the scripts. This value will be used ; unless "declare(encoding=...)" directive appears at the top of the script. ; Only affects if zend.multibyte is set. -; Default: "" ;zend.script_encoding = ; Allows to include or exclude arguments from stack traces generated for exceptions. ; In production, it is recommended to turn this setting on to prohibit the output ; of sensitive information in stack traces -; Default: Off -zend.exception_ignore_args = Off +; Default Value: Off +; Development Value: Off +; Production Value: On +zend.exception_ignore_args = On + +; Allows setting the maximum string length in an argument of a stringified stack trace +; to a value between 0 and 1000000. +; This has no effect when zend.exception_ignore_args is enabled. +; Default Value: 15 +; Development Value: 15 +; Production Value: 0 +; In production, it is recommended to set this to 0 to reduce the output +; of sensitive information in stack traces. +zend.exception_string_param_max_len = 0 ;;;;;;;;;;;;;;;;; ; Miscellaneous ; @@ -406,7 +427,7 @@ max_input_time = 60 ; Maximum amount of memory a script may consume ; http://php.net/memory-limit -memory_limit = 256M +memory_limit = 512M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Error handling and logging ; @@ -458,11 +479,11 @@ memory_limit = 256M ; E_ALL & ~E_NOTICE (Show all errors, except for notices) ; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED +; Default Value: E_ALL ; Development Value: E_ALL ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT ; http://php.net/error-reporting -error_reporting = E_ALL +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; This directive controls whether or not and where PHP will output errors, ; notices and warnings too. Error output is very useful during development, but @@ -479,18 +500,16 @@ error_reporting = E_ALL ; Development Value: On ; Production Value: Off ; http://php.net/display-errors -display_errors = On +display_errors = Off ; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. We strongly recommend you -; set this to 'off' for production servers. -; Default Value: Off +; separately from display_errors. We strongly recommend you set this to 'off' +; for production servers to avoid leaking configuration details. +; Default Value: On ; Development Value: On ; Production Value: Off ; http://php.net/display-startup-errors -display_startup_errors = On +display_startup_errors = Off ; Besides displaying errors, PHP can also log errors to locations such as a ; server-specific log, STDERR, or a location specified by the error_log @@ -524,19 +543,9 @@ ignore_repeated_source = Off ; http://php.net/report-memleaks report_memleaks = On -; This setting is on by default. +; This setting is off by default. ;report_zend_debug = 0 -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; This directive is DEPRECATED. -; Default Value: Off -; Development Value: Off -; Production Value: Off -; http://php.net/track-errors -;track_errors = Off - ; Turn off normal error reporting and emit XML-RPC error XML ; http://php.net/xmlrpc-errors ;xmlrpc_errors = 0 @@ -846,7 +855,7 @@ file_uploads = On upload_max_filesize = 200M ; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 +max_file_uploads = 100 ;;;;;;;;;;;;;;;;;; ; Fopen wrappers ; @@ -915,7 +924,7 @@ default_socket_timeout = 60 ;extension=ffi ;extension=ftp ;extension=fileinfo -;extension=gd2 +;extension=gd ;extension=gettext ;extension=gmp ;extension=intl @@ -925,6 +934,7 @@ default_socket_timeout = 60 ;extension=exif ; Must be after mbstring as it depends on it ;extension=mysqli ;extension=oci8_12c ; Use with Oracle Database 12c Instant Client +;extension=oci8_19 ; Use with Oracle Database 19 Instant Client ;extension=odbc ;extension=openssl ;extension=pdo_firebird @@ -945,9 +955,10 @@ default_socket_timeout = 60 ;extension=sodium ;extension=sqlite3 ;extension=tidy -;extension=xmlrpc ;extension=xsl +;zend_extension=opcache + ;;;;;;;;;;;;;;;;;;; ; Module Settings ; ;;;;;;;;;;;;;;;;;;; @@ -968,10 +979,10 @@ cli_server.color = On ;date.default_longitude = 35.2333 ; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 +;date.sunrise_zenith = 90.833333 ; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 +;date.sunset_zenith = 90.833333 [filter] ; http://php.net/filter.default @@ -1048,8 +1059,6 @@ cli_server.color = On ; http://php.net/pdo-odbc.connection-pooling ;pdo_odbc.connection_pooling=strict -;pdo_odbc.db2_instance_name - [Pdo_mysql] ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. @@ -1190,7 +1199,7 @@ mysqlnd.collect_statistics = On ; Enable / Disable collection of memory usage statistics by mysqlnd which can be ; used to tune and monitor MySQL operations. -mysqlnd.collect_memory_statistics = On +mysqlnd.collect_memory_statistics = Off ; Records communication from all extensions using mysqlnd to the specified log ; file. @@ -1563,7 +1572,7 @@ session.sid_bits_per_character = 5 ; Development Value: 1 ; Production Value: -1 ; http://php.net/zend.assertions -zend.assertions = 1 +zend.assertions = -1 ; Assert(expr); active by default. ; http://php.net/assert.active @@ -1585,11 +1594,6 @@ zend.assertions = 1 ; http://php.net/assert.callback ;assert.callback = 0 -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - [COM] ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs ; http://php.net/com.typelib-file @@ -1615,6 +1619,10 @@ zend.assertions = 1 ; Default: system ANSI code page ;com.code_page= +; The version of the .NET framework to use. The value of the setting are the first three parts +; of the framework's version number, separated by dots, and prefixed with "v", e.g. "v4.0.30319". +;com.dotnet_version= + [mbstring] ; language for internal character representation. ; This affects mb_send_mail() and mbstring.detect_order. @@ -1632,7 +1640,7 @@ zend.assertions = 1 ; http input encoding. ; mbstring.encoding_translation = On is needed to use this setting. ; If empty, default_charset or input_encoding or mbstring.input is used. -; The precedence is: default_charset < input_encoding < mbsting.http_input +; The precedence is: default_charset < input_encoding < mbstring.http_input ; http://php.net/mbstring.http-input ;mbstring.http_input = @@ -1664,20 +1672,8 @@ zend.assertions = 1 ; http://php.net/mbstring.substitute-character ;mbstring.substitute_character = none -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -; Default: Off -;mbstring.strict_detection = On +; Enable strict encoding detection. +;mbstring.strict_detection = Off ; This directive specifies the regex pattern of content types for which mb_output_handler() ; is activated. @@ -1686,12 +1682,10 @@ zend.assertions = 1 ; This directive specifies maximum stack depth for mbstring regular expressions. It is similar ; to the pcre.recursion_limit for PCRE. -; Default: 100000 ;mbstring.regex_stack_limit=100000 ; This directive specifies maximum retry count for mbstring regular expressions. It is similar ; to the pcre.backtrack_limit for PCRE. -; Default: 1000000 ;mbstring.regex_retry_limit=1000000 [gd] @@ -1806,6 +1800,11 @@ ldap.max_links = -1 ; size of the optimized code. ;opcache.save_comments=1 +; If enabled, compilation warnings (including notices and deprecations) will +; be recorded and replayed each time a file is included. Otherwise, compilation +; warnings will only be emitted when the file is first cached. +;opcache.record_warnings=0 + ; Allow file existence override (file_exists, etc.) performance feature. ;opcache.enable_file_override=0 @@ -1883,7 +1882,7 @@ ldap.max_links = -1 ; Enables or disables copying of PHP code (text segment) into HUGE PAGES. ; This should improve performance, but requires appropriate OS configuration. -;opcache.huge_code_pages=0 +;opcache.huge_code_pages=1 ; Validate cached file permissions. ;opcache.validate_permission=0