├── .dockerignore ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── config.yml ├── dependabot.yml └── workflows │ ├── main.yml │ └── manual.yml ├── CHANGELOG.md ├── Dockerfile ├── Dockerfile.debian ├── LICENSE ├── README.md ├── examples ├── .gitignore ├── .gitkeep └── compose.yml ├── install ├── assets │ ├── defaults │ │ └── 20-php-fpm │ ├── functions │ │ └── 20-php-fpm │ └── php-fpm │ │ ├── cli │ │ └── php.ini │ │ ├── fpm │ │ ├── default.logformat │ │ ├── json.logformat │ │ ├── php-fpm.conf │ │ └── php.ini │ │ └── mods-available │ │ ├── apcu.ini │ │ └── opcache.ini ├── etc │ ├── cont-init.d │ │ └── 20-php-fpm │ ├── fluent-bit │ │ └── parsers.d │ │ │ └── php-fpm.conf │ ├── nginx │ │ └── snippets │ │ │ ├── monitoring.conf │ │ │ └── php-fpm.conf │ ├── services.available │ │ └── 20-php-fpm │ │ │ └── run │ └── zabbix │ │ └── zabbix_agentd.conf.d │ │ ├── php-fpm.conf │ │ └── scripts │ │ └── php │ │ ├── opcache-settings.php │ │ └── opcache-status.php └── usr │ └── sbin │ └── php-ext └── zabbix_templates ├── app-php_fpm.json └── app-php_opcache.json /.dockerignore: -------------------------------------------------------------------------------- 1 | examples/ 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [tiredofit] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: If something isn't working right.. 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Summary 11 | 12 | 13 | 14 | 15 | ### Steps to reproduce 16 | 17 | 18 | 19 | 20 | ### What is the expected *correct* behavior? 21 | 22 | 23 | 24 | 25 | ### Relevant logs and/or screenshots 26 | 27 | 28 | 29 | ### Environment 30 | 31 | 32 | - Image version / tag: 33 | - Host OS: 34 | 35 |
36 | Any logs | docker-compose.yml 37 |
38 | 39 | 40 | 41 | ### Possible fixes 42 | 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or feature 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | --- 11 | name: Feature Request 12 | about: Suggest an idea for this project 13 | 14 | --- 15 | 16 | **Description of the feature** 17 | 18 | 19 | **Benftits of feature** 20 | 21 | 22 | **Additional context** 23 | 24 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 7.7.19 2025-04-27 2 | 3 | ### Added 4 | - Pin to tiredofit/nginx:6.5.18 5 | 6 | 7 | ## 7.7.18 2025-04-25 8 | 9 | ### Added 10 | - Pin to tiredofit/nginx:6.5.17 11 | 12 | 13 | ## 7.7.17 2024-12-19 14 | 15 | ### Reverted 16 | - Remove php84-spell component to support building under Alpine 17 | 18 | 19 | ## 7.7.16 2024-12-12 20 | 21 | ### Added 22 | - Pin to tiredofit/nginx:6.5.10 23 | 24 | 25 | ## 7.7.15 2024-12-09 26 | 27 | ### Added 28 | - Alpine pin to tiredofit/nginx:6.5.8 29 | 30 | 31 | ## 7.7.14 2024-12-07 32 | 33 | ### Added 34 | - Add PHP 8.4 Support 35 | 36 | ### Changed 37 | - Switch PHP 8.3 and PHP 8.2 to use Alpine 3.21 as base 38 | 39 | 40 | ## 7.7.13 2024-10-22 41 | 42 | ### Added 43 | - Pin to tiredofit/nginx:6.5.4 44 | 45 | 46 | ## 7.7.12 2024-10-04 47 | 48 | ### Added 49 | - Pin to tiredofit/alpine:6.5.3 50 | 51 | 52 | ## 7.7.11 2024-09-26 53 | 54 | ### Changed 55 | - Cleanup php-ext script 56 | - Pin to tiredofit/nginx:6.5.2 57 | 58 | 59 | ## 7.7.10 2024-09-25 60 | 61 | ### Added 62 | - Add php-ext disable reset statement to refresh environments 63 | 64 | 65 | ## 7.7.9 2024-09-25 66 | 67 | ### Changed 68 | - Remove stray cat command in Dockerfile 69 | 70 | 71 | ## 7.7.8 2024-05-01 72 | 73 | ### Changed 74 | - Change sury.org GPG key for Debian installations 75 | 76 | 77 | ## 7.7.7 2024-04-16 78 | 79 | ### Added 80 | - Add php83 extensions: ds,event,grpc,imagick,opentelemetry,pcov,rdkafka,smblient,ssh2 81 | - Add php82 extensions: decimal,ds,event,grpc,mailparse,mcrypt,opentelemetry,pcov,rdkafka,smbclient,ssh2,timezonedb,vips,xlswriter 82 | - Add php81 extensions: decimal,ds,luasandbox,mcrypt,opentelemetry,pcov,smbclient 83 | 84 | 85 | ## 7.7.6 2024-02-16 86 | 87 | ### Changed 88 | - Remove Suhosin from hp5.6 variant 89 | 90 | 91 | ## 7.7.5 2024-01-26 92 | 93 | ### Reverted 94 | - Remove lz4 extension from Debian variant 95 | 96 | 97 | ## 7.7.4 2023-12-08 98 | 99 | ### Changed 100 | - Add alpine:3.19 101 | 102 | 103 | ## 7.7.3 2023-12-05 104 | 105 | ### Changed 106 | - Change build for Alpine PHP 8.3 to not include 4 PECL extensions 107 | 108 | 109 | ## 7.7.2 2023-11-28 110 | 111 | ### Reverted 112 | - Drop php-lua extension 113 | 114 | 115 | ## 7.7.1 2023-11-28 116 | 117 | ### Changed 118 | - Remove `BOTH` Option for PHP_FPM_LISTEN_TYPE 119 | 120 | 121 | ## 7.7.0 2023-11-25 122 | 123 | ### Added 124 | - Allow listening on Unix Socket or TCP Socket (default Unix Socket) 125 | - Add host/ip restrictions for TCP listening 126 | - Add PHP_FPM_USER and PHP_FPM_GROUP variables to create isolation from upstream image (default NGINX_ or UNIT_ USER|GROUP) 127 | 128 | 129 | ## 7.6.16 2023-11-22 130 | 131 | ### Added 132 | - Introduce PHP 8.3 support 133 | 134 | 135 | ## 7.6.15 2023-09-13 136 | 137 | ### Changed 138 | - Fix PHP_TIMEOUT not affecting php-cli operations causing unnecessary Signal 15s in some cases 139 | 140 | 141 | ## 7.6.14 2023-09-05 142 | 143 | ### Changed 144 | - Fixed not working LLNG handler authentification 145 | - Fixed creating a default index page 146 | 147 | ## 7.6.13 2023-07-28 148 | 149 | ### Reverted 150 | - Remove php-decimal extension from Debian variant 151 | 152 | 153 | ## 7.6.12 2023-07-28 154 | 155 | ### Added 156 | - Add support for Debian Bookworm 157 | 158 | ### Changed 159 | - Cleanup some PHP directories that shouldn't exist on Debian variants 160 | 161 | 162 | ## 7.6.11 2023-07-25 163 | 164 | ### Changed 165 | - Change environment variable case 166 | 167 | 168 | ## 7.6.10 2023-07-06 169 | 170 | ### Added 171 | - Source defaults from upstream nginx container to avoid having to use NGINX_ENABLE_APPLICATION_CONFIGURATION=TRUE variable 172 | 173 | 174 | ## 7.6.9 2023-06-21 175 | 176 | ### Changed 177 | - Fix case introduced with 7.6.8 where authentication takes over default settings 178 | 179 | 180 | ## 7.6.8 2023-06-20 181 | 182 | ### Changed 183 | - Restructure authentication routines when no NGINX_SITE_ENABLED being used to properly allow NGINX_AUTHENTICATION_TYPE=LLNG to be used. 184 | 185 | 186 | ## 7.6.6 2023-06-19 187 | 188 | ### Changed 189 | - Stop building gnupg extension for 193 | 194 | ### Changed 195 | - Drop requirement of gnu-libiconv for < PHP 8.0 on alpine 196 | 197 | 198 | ## 7.6.4 2023-05-12 199 | 200 | ### Reverted 201 | - Remove php82-pecl-phalcon for Alpine 3.18 202 | 203 | 204 | ## 7.6.3 2023-05-12 205 | 206 | ### Changed 207 | - Strip pecl packages that no longer exist in Arch 3.18 repository for PHP 8.2 208 | 209 | 210 | ## 7.6.2 2023-05-10 211 | 212 | ### Changed 213 | - Change PHP 8.2 to build with Alpine 3.18 Base 214 | - Change PHP 8.1 to build with Alpine 3.18 Base 215 | - Drop PHP 3.17 base variant 216 | 217 | 218 | ## 7.6.1 2023-04-04 219 | 220 | ### Reverted 221 | - Remove spx extension from PHP 8.2 alpine 222 | 223 | 224 | ## 7.6.0 2023-03-24 225 | 226 | ### Added 227 | - Added dozens of extra modules for Alpine PHP 8.0, 8.1, 8.2 variants 228 | 229 | 230 | ## 7.5.6 2023-03-23 231 | 232 | ### Changed 233 | - Load MSGPACK when loading Redis module 234 | 235 | 236 | ## 7.5.5 2023-03-23 237 | 238 | ### Added 239 | - Add more OPCache options and fix broken options 240 | 241 | 242 | ## 7.5.4 2023-03-23 243 | 244 | ### Added 245 | - Add testing repository for PHP 8.2-alpine 246 | 247 | 248 | ## 7.5.3 2023-03-23 249 | 250 | ### Added 251 | - Introduce PHP_HIDE_X_POWERED_BY variable 252 | 253 | 254 | ## 7.5.2 2023-03-20 255 | 256 | ### Added 257 | - Add gnu-libconv package 258 | 259 | 260 | ## 7.5.1 2023-03-16 261 | 262 | ### Changed 263 | - Change log_errors_max_len to 0 in php.ini from 1024 264 | 265 | ### Reverted 266 | - Strip php_admin_value[log_errors_max_len] from fpm config 267 | 268 | 269 | ## 7.5.0 2023-03-15 270 | 271 | ### Changed 272 | - Quiet down output when loading defaults (xxx is already loaded! warnings) 273 | - Rework initialization 274 | - Fix a weird opcache issue 275 | 276 | 277 | ## 7.4.2 2023-02-21 278 | 279 | ### Changed 280 | - Fix for LLNG_AUTHENTICATION_TYPE not reading variables properly 281 | 282 | 283 | ## 7.4.1 2023-01-16 284 | 285 | ### Changed 286 | - Fix for 7.4.0 287 | 288 | 289 | ## 7.4.0 2023-01-15 290 | 291 | ### Added 292 | - Add JIT Compilation support by means of PHP_OPCACHE_JIT_MODE and PHP_OPCACHE_BUFFER_SIZE variables (8.x only) 293 | 294 | ### Changed 295 | - Minor formatting fixes 296 | 297 | 298 | ## 7.3.4 2023-01-11 299 | 300 | ### Changed 301 | - Convert alias to function in php-ext for non interactive sessions 302 | 303 | 304 | ## 7.3.3 2023-01-10 305 | 306 | ### Changed 307 | - Fix for `php-ext` not reading modules with underscores properly (credit timoschwarzer@github) 308 | 309 | 310 | ## 7.3.2 2022-12-14 311 | 312 | ### Changed 313 | - Fix PHP_BASE issue with modules not loading introduced with 7.3.0 314 | 315 | 316 | ## 7.3.1 2022-12-13 317 | 318 | ### Changed 319 | - Patchup for 8.2.x on Alpine systems 320 | 321 | 322 | ## 7.3.0 2022-12-11 323 | 324 | ### Added 325 | - Introduce PHP 8.2 Support 326 | 327 | ### Changed 328 | - Rework Dockerfiles 329 | 330 | 331 | ## 7.2.1 2022-11-23 332 | 333 | ### Changed 334 | - Switch PHP 8.1 base to Alpine 3.17 335 | 336 | 337 | ## 7.2.0 2022-10-13 338 | 339 | ### Added 340 | - Introduce customizable Opcache and APC environment variables 341 | 342 | 343 | ## 7.1.1 2022-10-05 344 | 345 | ### Changed 346 | - Remvoe /var/log entries in Dockerfile build 347 | 348 | 349 | ## 7.1.0 2022-10-01 350 | 351 | ### Added 352 | - Convert to using update_template functions when configuring 353 | 354 | ### Changed 355 | - Fix an error where sample php file wasn't being created properly 356 | 357 | 358 | ## 7.0.11 2022-09-16 359 | 360 | ### Changed 361 | - Change the way PHP_DISPLAY_ERRORS works in code - True / False actually works 362 | 363 | 364 | ## 7.0.10 2022-08-17 365 | 366 | ### Changed 367 | - Switch to using exec to have process take over pid 368 | 369 | 370 | ## 7.0.9 2022-08-08 371 | 372 | ### Changed 373 | - Additional fixes to 7.0.8 374 | 375 | 376 | ## 7.0.8 2022-08-08 377 | 378 | ### Changed 379 | - Fix for Kitchen Sink mode showing pathnames on print_notice command 380 | - Stop using log_length parameter for < PHP-FPM 7.3 381 | 382 | 383 | ## 7.0.7 2022-07-18 384 | 385 | ### Changed 386 | - Fix for keepalives in upstream 387 | 388 | 389 | ## 7.0.6 2022-07-09 390 | 391 | ### Changed 392 | - Escape document_root for FastCGI default scripts 393 | 394 | 395 | ## 7.0.5 2022-07-06 396 | 397 | ### Changed 398 | - Fix for blank configuration not passing proper fastcgi_params 399 | - Stop throwing an error for openssl if it doesn't exist in the slightest 400 | 401 | 402 | ## 7.0.4 2022-07-06 403 | 404 | ### Changed 405 | - Debian: Switch to PHP_BASE versioned msgpack module 406 | 407 | 408 | ## 7.0.3 2022-07-05 409 | 410 | ### Changed 411 | - Add ARG for easier build argument shifting with CI and command line 412 | 413 | 414 | ## 7.0.2 2022-07-04 415 | 416 | ### Changed 417 | - Bugfix when there is no default.conf file available 418 | 419 | 420 | ## 7.0.1 2022-07-03 421 | 422 | ### Added 423 | - Add PHP_FPM_OUTPUT_BUFFER_SIZE environment variable 424 | 425 | 426 | ## 7.0.0 2022-06-23 427 | 428 | ### Added 429 | - Rewrote entire image and split into functions to be reused in descendent images 430 | - Rework to support tiredofit/nginx:6.0.0 and its changes 431 | 432 | ### Changed 433 | - Rename CONTAINER_MODE variable 434 | - Quiet down output on extension loading/unloading 435 | 436 | 437 | ## 6.4.10 2022-05-24 438 | 439 | ### Added 440 | - Alpine: Switch PHP 8 and 8.1 to Alpine 3.16 base 441 | 442 | 443 | ## 6.4.9 2022-04-12 444 | 445 | ### Changed 446 | - Add support for debugging with PHPStorm 447 | 448 | ## 6.4.8 2022-04-11 449 | 450 | ### Changed 451 | - Fix for open brace in if statement 452 | - Revamp Xdebug options for PHP 7.2 and higher 453 | 454 | 455 | ## 6.4.7 2022-04-06 456 | 457 | ### Changed 458 | - Adjust defaults to use proper if statements as opposed to shortcuts 459 | 460 | 461 | ## 6.4.6 2022-03-18 462 | 463 | ### Changed 464 | - Fix for Debian images not including redis extension 465 | 466 | 467 | ## 6.4.5 2022-03-11 468 | 469 | ### Changed 470 | - Sanity checks to be able to survive "warm" restarts 471 | 472 | 473 | ## 6.4.4 2022-03-08 474 | 475 | ### Added 476 | - Remove php74-embed 477 | 478 | 479 | ## 6.4.3 2022-03-04 480 | 481 | ### Changed 482 | - Change the way that upstream blocks are being added - stop relying on default.conf, instead put them in nginx.conf 483 | 484 | 485 | ## 6.4.2 2022-03-03 486 | 487 | ### Changed 488 | - Patchup for 6.4.1 489 | 490 | 491 | ## 6.4.1 2022-03-02 492 | 493 | ### Added 494 | - Add PHP_FPM_POST_INIT_SCRIPT variable to execute scripts before php-fpm process starts 495 | - Add PHP_FPM_POST_INIT_COMMAND variable to execute command before php-fpm-process starts 496 | 497 | 498 | ## 6.4.0 2022-02-23 499 | 500 | ### Added 501 | - Add multiple PHP upstream hosts by default 502 | - Update LLNG Authentication to use Upstream Hosts 503 | 504 | ### Changed 505 | - Code Cleanup, refactoring 506 | 507 | 508 | ## 6.3.7 2022-02-22 509 | 510 | ### Added 511 | - Patchup Alpine Mono Dockerfile to properly build PHP 8.1 variants 512 | 513 | 514 | ## 6.3.6 2022-02-09 515 | 516 | ### Changed 517 | - Fixes for builds showing up as PHP 8.1 instead of what they should be 518 | - Base image updates 519 | 520 | ### Reverted 521 | 522 | 523 | ## 6.3.5 2021-12-28 524 | 525 | ### Changed 526 | - Fixup for LibTidy throwing errors 527 | 528 | 529 | ## 6.3.4 2021-12-27 530 | 531 | ### Changed 532 | - Fix for Zabbix Opcache monitoring 533 | 534 | 535 | ## 6.3.3 2021-12-16 536 | 537 | ### Changed 538 | - Cleanup some of the autodiscover routines should Nginx or PHP-FPM be running in 'standalone' mode 539 | 540 | 541 | ## 6.3.2 2021-12-14 542 | 543 | ### Changed 544 | - Fix for Docker Mono repo for PHP < 7.3 failing 545 | 546 | 547 | ## 6.3.1 2021-12-10 548 | 549 | ### Changed 550 | - Fix for 6.3.0 Zabbix Templates and switch to User Parameters 551 | 552 | 553 | ## 6.3.0 2021-12-07 554 | 555 | ### Changed 556 | - Rework Zabbix Monitoring scripts and templates 557 | 558 | 559 | ## 6.2.15 2021-12-01 560 | 561 | ### Changed 562 | - Stop OpenSSL warning in PHP 8.1 563 | 564 | 565 | ## 6.2.14 2021-11-24 566 | 567 | ### Added 568 | - Change PHP 7.4 and 8.0 to use Alpine 3.15 as base 569 | 570 | 571 | ## 6.2.13 2021-11-16 572 | 573 | ### Changed 574 | - Fix for Zabbix PHP-FPM Metrics not functioning when AUTHENTICATION_TYPE=LLNG 575 | 576 | 577 | ## 6.2.12 2021-11-16 578 | 579 | ### Changed 580 | - Fix for XDebug Log Path 581 | 582 | 583 | ## 6.2.11 2021-11-16 584 | 585 | ### Changed 586 | - Adjustment to Log Level integer 587 | 588 | 589 | ## 6.2.10 2021-11-10 590 | 591 | ### Changed 592 | - Change the way that access logs are being configured on startup for those who don't stop and destroy a container completely 593 | 594 | 595 | ## 6.2.9 2021-10-28 596 | 597 | ### Changed 598 | - Debian: Fix for pulling in MariaDB repository 599 | 600 | 601 | ## 6.2.8 2021-10-28 602 | 603 | ### Changed 604 | - Fix with pulling in MariaDB Repository 605 | 606 | 607 | ## 6.2.7 2021-10-20 608 | 609 | ### Added 610 | - Add mariadb-connector-c to fix SHA2 problems with connecting to MariaDB 8.0 systems 611 | 612 | 613 | ## 6.2.6 2021-10-19 614 | 615 | ### Added 616 | - Add PHP_LOG_LIMIT environment variable to ensure single line log levels in access/error.log 617 | 618 | 619 | ## 6.2.5 2021-09-04 620 | 621 | ### Changed 622 | - Redo how logrotate files were created 623 | 624 | 625 | ## 6.2.4 2021-09-04 626 | 627 | ### Changed 628 | - Opcache key removal for Zabbix monitoring 629 | 630 | 631 | ## 6.2.3 2021-09-04 632 | 633 | ### Changed 634 | - Fix for monitoring PHP-FPM 635 | 636 | 637 | ## 6.2.2 2021-09-01 638 | 639 | ### Changed 640 | - Fix for logformats 641 | 642 | 643 | ## 6.2.1 2021-09-01 644 | 645 | ### Changed 646 | - Fix for msmtp not working due to a change in upstream base images 647 | 648 | 649 | ## 6.2.0 2021-08-29 650 | 651 | ### Added 652 | - Added Access Log support with standard/default string output or json output 653 | - Fluent-Bit Log Parsing support 654 | 655 | 656 | ## 6.1.21 2021-08-19 657 | 658 | ### Changed 659 | - Change the way dependent modules are loaded in defaults 660 | 661 | 662 | ## 6.1.20 2021-08-18 663 | 664 | ### Changed 665 | - Change to PECL http package 666 | 667 | 668 | ## 6.1.19 2021-08-18 669 | 670 | ### Changed 671 | - Change to PHP Memcached plugin for debian 672 | 673 | 674 | ## 6.1.18 2021-08-05 675 | 676 | ### Added 677 | - Add another value for socket timeout 678 | - Cleanup some opcache console annoyances 679 | 680 | 681 | ## 6.1.17 2021-07-12 682 | 683 | ### Changed 684 | - Move around some LLNG Authentication blocks 685 | 686 | 687 | ## 6.1.16 2021-07-05 688 | 689 | ### Added 690 | - Support upstream image changes 691 | 692 | ## 6.1.15 2021-06-08 693 | 694 | ### Added 695 | - Add Hook to load IGBINARY when PHP_ENABLE_MEMCACHED=TRUE 696 | 697 | 698 | ## 6.1.14 2021-06-04 699 | 700 | ### Added 701 | - Enable APC Caching for CLI 702 | 703 | 704 | ## 6.1.13 2021-05-29 705 | 706 | ### Changed 707 | - Final permissions fix for MSMTP 708 | 709 | 710 | ## 6.1.12 2021-05-25 711 | 712 | ### Changed 713 | - Additional checks for msmtp usage - If ENABLE_SMTP=FALSE then don't execute permissions settings 714 | 715 | 716 | ## 6.1.11 2021-05-25 717 | 718 | ### Changed 719 | - Change the way that LLNG authentication gets loaded 720 | 721 | 722 | ## 6.1.10 2021-05-24 723 | 724 | ### Changed 725 | - Fix for 6.1.9 permissions 726 | 727 | 728 | ## 6.1.9 2021-05-24 729 | 730 | ### Changed 731 | - Update msmtprc file with nginx user/group permissions to allow php-fpm to send 732 | - Shuffle XDebug environment variables and configuraiton around 733 | 734 | 735 | ## 6.1.8 2021-05-19 736 | 737 | ### Added 738 | - Add gpgme package (Alpine) 739 | 740 | ### Changed 741 | - Fix for php-ext enable script to stop loading json if PHP > 8 742 | - GPG extension loading fix 743 | 744 | 745 | ## 6.1.7 2021-05-05 746 | 747 | ### Changed 748 | - Force OPENSSL extension to be activated by default to fix composer errors 749 | 750 | 751 | ## 6.1.6 2021-05-04 752 | 753 | ### Changed 754 | - Fix for opcache being loaded twice in some scenarios 755 | 756 | 757 | ## 6.1.5 2021-05-03 758 | 759 | ### Changed 760 | - Fix for enabling json warning under php8 761 | 762 | 763 | ## 6.1.4 2021-05-03 764 | 765 | ### Changed 766 | - Fix for JSON for 770 | 771 | ### Changed 772 | - Add PHP_ENABLE_SESSION=TRUE to defaults 773 | - Set PHP_ENABLE_IGBINARY=TRUE when PHP_ENABLE_REDIS=TRUE 774 | 775 | 776 | ## 6.1.2 2021-05-01 777 | 778 | ### Changed 779 | - Fixes to php extension script specifically under Alpine 780 | 781 | 782 | ## 6.1.1 2021-05-01 783 | 784 | ### Changed 785 | - Fix for determining PHP version on runtime 786 | 787 | 788 | ## 6.1.0 2021-04-22 789 | 790 | ### Changed 791 | - Unified Script for Alpine and Debian 792 | - Merged all changes up to 6.xx into Alpine build 793 | 794 | ## 6.0.1 2021-04-16 795 | 796 | ### Changed 797 | - Fix PHP Extension script 798 | - Opcache seems to want to load twice for some reason, dirty hack enabled 799 | - Composer wasn't installing properly 800 | 801 | 802 | ## 6.0.0 2021-04-16 803 | 804 | ### Added 805 | - Merged Debian branches into one - Use Build Argument of PHP_BASE to build `7.3` `7.4` or `8.0` 806 | - Composer 2.x 807 | - Massively revamped module loading. Try `php-env` from the command line to enable, disable, see modules available per version 808 | - Building for Stretch and Buster, ready for Bullseye 809 | - Building and amd64, arm7, arm64 810 | 811 | ## 5.6.0 2020-10-26 812 | 813 | ### Added 814 | - Add composer version declaration (pinning to 1.10.16) 815 | 816 | 817 | ## 5.5.3 2020-08-29 818 | 819 | ### Added 820 | - Add ENABLE_PHP_FPM environment variable 821 | 822 | 823 | ## 5.5.2 2020-08-10 824 | 825 | ### Changed 826 | - Fix to regex for LLNG Authentication 827 | 828 | 829 | ## 5.5.1 2020-07-16 830 | 831 | ### Changed 832 | - Fix logrotate for PHP-FPM 833 | 834 | 835 | ## 5.5.0 2020-06-09 836 | 837 | ### Added 838 | - Update to support tiredofit/debian 5.0.0 base image 839 | 840 | 841 | ## 5.4.1 2020-06-05 842 | 843 | ### Changed 844 | - Move /etc/s6/services to /etc/services.d 845 | 846 | 847 | ## 5.4.0 2020-05-13 848 | 849 | ### Added 850 | - PHP 7.3 - Debian Buster Variant 851 | 852 | 853 | ## 5.3.7 2020-04-21 854 | 855 | ### Changed 856 | - Remove extra logrotate.d file added by packages 857 | 858 | 859 | ## 5.3.6 2020-04-21 860 | 861 | ### Changed 862 | - Fix for PHP Plugins not enabling correctly 863 | 864 | 865 | ## 5.3.5 2020-04-18 866 | 867 | ### Added 868 | - Update to support tiredofit/alpine 4.5.1 base image 869 | 870 | 871 | ## 5.3.4 2020-03-16 872 | 873 | ### Changed 874 | - Change msmtp configuration 875 | 876 | 877 | ## 5.3.3 2020-03-04 878 | 879 | ### Added 880 | - Update image to support new tiredofit/alpine:4.4.0 base image 881 | 882 | ## 5.3.1 2020-01-20 883 | 884 | ### Changed 885 | - Change the way PHP XDebug is being called 886 | 887 | 888 | ## 5.3.0 2020-01-04 889 | 890 | ### Added 891 | - Add new `CONTAINER_MODE` environment variable to allow standalone operation for load balancing 892 | - Add new `PHP_WEBROOT` environment variable when `CONTAINER_MODE` set to `php-fpm` 893 | 894 | 895 | ## 5.2.2 2020-01-03 896 | 897 | ### Added 898 | - ADD PHP_POST_MAX_SIZE environment variable 899 | 900 | ### Changed 901 | - Cleanup with LLNG Authentication 902 | - Properly assign PHP_UPLOAD_MAX_SIZE and PHP_POST_MAX_SIZE variables 903 | 904 | 905 | ## 5.2.0 2019-12-31 906 | 907 | ### Added 908 | - Move defaults to /assets/functions files 909 | 910 | ### Changed 911 | - Change warnings to notices 912 | 913 | 914 | ## 5.1.0 2019-12-29 915 | 916 | ### Added 917 | - Update to support new tiredofit/alpine base image 918 | 919 | 920 | ## 5.0.4 2019-12-19 921 | 922 | ### Changed 923 | - Change to LLNG Authentication Auto Configuration Routines 924 | 925 | 926 | ## 5.0.3 2019-12-18 927 | 928 | ### Changed 929 | - Fixed error with display errors configuration 930 | 931 | ## 5.0.2 2019-12-18 932 | 933 | ### Changed 934 | - Change to support dynamic webserver user/group 935 | 936 | 937 | ## 5.0.1 2019-12-04 938 | 939 | ### Changed 940 | - Make MySQL Default Enabled 941 | 942 | 943 | ## 5.0.0 2019-12-04 944 | 945 | ### Added 946 | - Reworked entire image 947 | - Added many new variables 948 | - Basing off of tiredofit/nginx 949 | - Code Cleanup 950 | 951 | 952 | ## 4.4.2 2019-11-18 953 | 954 | ### Changed 955 | - Update Nginx proxy temp location 956 | 957 | 958 | ## 4.4.1 2019-07-08 959 | 960 | * Add tmp folder during startup to avoid bootloop 961 | 962 | ## 4.4 2019-06-19 963 | 964 | * PHP 7.3 965 | * Alpine 3.10 966 | 967 | ## 4.3 2019-03-03 968 | 969 | * Move Alpine base to 3.9 970 | 971 | ## 4.2 2018-12-17 972 | 973 | * Add Nginx tmp cache directory 974 | 975 | ## 4.1 2018-11-28 976 | 977 | * Fix Timezone setting for php.ini 978 | 979 | ## 4.0.1 2018-11-19 980 | 981 | * Update further LLNG 982 | 983 | ## 4.0 2018-04-28 984 | 985 | * Ability to protect service via basic authentication or using LemonLDAP:NG Handlers 986 | 987 | 988 | ## 3.7 2018-04-22 989 | 990 | * Tweak SMTP to always route through msmtp based on new Base Image Changes 991 | 992 | ## 3.6 2018-04-02 993 | 994 | * Added MAINTENANCE environment variable to move system to maintenance mode. Also maintenance script (off/on/sleep 60) inside container. 995 | 996 | ## 2018-03-18 3.5 997 | 998 | * Add `STAGE` variable to be passed to PHP for Development/Production Purposes 999 | 1000 | ## 2018-02-20 3.4 1001 | 1002 | * Add Reverse Proxy Detection 1003 | 1004 | ## 2018-02-14 3.3 1005 | 1006 | * Remove Redundant Entrypoint 1007 | * Fix Paths for enabled php modules 1008 | 1009 | ## 2018-02-01 3.2 1010 | 1011 | * Fix PHP Timezone Issue 1012 | * Add Zabbix Scripts 1013 | 1014 | ## 2017-11-30 edge-3.1 1015 | 1016 | * Switched to Edge Base 1017 | 1018 | 1019 | ## 2017-09-17 3.1 1020 | 1021 | * Fix Issue with PHP XDebug 1022 | * Added Imagick Extension 1023 | 1024 | ## 2017-08-27 3.0 1025 | 1026 | * Big change (in image size) due to adding all available PHP Extensions 1027 | * Debug Mode via XDebug set via Environment Variables 1028 | * All PHP Extensions able to be enabled of disabled via Environment Variables 1029 | 1030 | ## 2017-07-12 2.6 1031 | 1032 | * Added Checking to wait to start services in sequence 1033 | 1034 | ## 2017-07-12 2.5 1035 | 1036 | * Added Composer, memcached, and sqlite extensions 1037 | 1038 | ## 2017-07-06 2.4 1039 | 1040 | * Added proper logging for php-fpm 1041 | 1042 | ## 2017-07-06 2.3 1043 | 1044 | * Add PHP_TIMEOUT 1045 | 1046 | ## 2017-07-03 2.2 1047 | 1048 | * Added Logrotate 1049 | 1050 | ## 2017-07-01 2.1 1051 | 1052 | * Sanity Check and write initialization state to /tmp/.container/*service name 1053 | * Added MSMTP to take place of sendmail 1054 | 1055 | 1056 | ## 2017-06-23 2.0 1057 | 1058 | * s6.d Process Seperation 1059 | * PHP-FPM run as NGINX 1060 | * Nginx Zabbix Checks set to port 73 1061 | * Nginx Uses conf.d file for Loading Site 1062 | 1063 | 1064 | ## 2017-05-29 1.3 1065 | 1066 | * Tracking Alpine 3.4 1067 | * PHP 5.6 1068 | 1069 | ## 2017-04-07 1.2 1070 | 1071 | * Rebase 1072 | 1073 | ## 2017-02-08 1.1 1074 | 1075 | * Added mariadb-client 1076 | 1077 | ## 2017-02-08 1.0 1078 | 1079 | * Initial Release 1080 | * Alpine:edge 1081 | * PHP7 1082 | * Zabbix 1083 | 1084 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG DISTRO=alpine 2 | ARG DISTRO_VARIANT=edge 3 | 4 | FROM docker.io/tiredofit/nginx:${DISTRO}-${DISTRO_VARIANT}-6.5.18 5 | LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" 6 | 7 | ARG PHP_BASE 8 | 9 | ENV PHP_BASE=${PHP_BASE:-"8.4"} \ 10 | PHP_ENABLE_APCU=TRUE \ 11 | PHP_ENABLE_BCMATH=TRUE \ 12 | PHP_ENABLE_BZ2=TRUE \ 13 | PHP_ENABLE_CTYPE=TRUE \ 14 | PHP_ENABLE_CURL=TRUE \ 15 | PHP_ENABLE_DOM=TRUE \ 16 | PHP_ENABLE_EXIF=TRUE \ 17 | PHP_ENABLE_FILEINFO=TRUE \ 18 | PHP_ENABLE_GD=TRUE \ 19 | PHP_ENABLE_ICONV=TRUE \ 20 | PHP_ENABLE_IMAP=TRUE \ 21 | PHP_ENABLE_INTL=TRUE \ 22 | PHP_ENABLE_MBSTRING=TRUE \ 23 | PHP_ENABLE_MYSQLI=TRUE \ 24 | PHP_ENABLE_MYSQLND=TRUE \ 25 | PHP_ENABLE_OPCACHE=TRUE \ 26 | PHP_ENABLE_OPENSSL=TRUE \ 27 | PHP_ENABLE_PDO=TRUE \ 28 | PHP_ENABLE_PDO_MYSQL=TRUE \ 29 | PHP_ENABLE_PGSQL=TRUE \ 30 | PHP_ENABLE_PHAR=TRUE \ 31 | PHP_ENABLE_SESSION=TRUE \ 32 | PHP_ENABLE_SIMPLEXML=TRUE \ 33 | PHP_ENABLE_TOKENIZER=TRUE \ 34 | PHP_ENABLE_XML=TRUE \ 35 | PHP_ENABLE_XMLREADER=TRUE \ 36 | PHP_ENABLE_XMLWRITER=TRUE \ 37 | CONTAINER_NAME=nginx-php-fpm-app \ 38 | CONTAINER_ENABLE_MESSAGING=TRUE \ 39 | NGINX_ENABLE_CREATE_SAMPLE_HTML=FALSE \ 40 | IMAGE_NAME="tiredofit/nginx-php-fpm" \ 41 | IMAGE_REPO_URL="https://github.com/tiredofit/docker-nginx-php-fpm/" 42 | 43 | ### Dependency Installation 44 | RUN case "${PHP_BASE}" in \ 45 | 8.4 ) export php_folder="84" export build_gnupg=true ;; \ 46 | 8.3 ) export php_folder="83" export build_gnupg=true ;; \ 47 | 8.2 ) export php_folder="82" export build_gnupg=true ;; \ 48 | 8.1 ) export php_folder="81" export build_gnupg=true ;; \ 49 | *) export php_folder=${PHP_BASE:0:1} ; export build_gnupg=false ;; \ 50 | esac ; \ 51 | export PHP_8_4_RUN_DEPS=" \ 52 | gnu-libiconv \ 53 | mariadb-connector-c \ 54 | php84 \ 55 | php84-bcmath \ 56 | php84-bz2 \ 57 | php84-calendar \ 58 | php84-common \ 59 | php84-ctype \ 60 | php84-curl \ 61 | php84-dba \ 62 | php84-dom \ 63 | php84-embed \ 64 | php84-enchant \ 65 | php84-exif \ 66 | php84-ffi \ 67 | php84-fileinfo \ 68 | php84-fpm \ 69 | php84-ftp \ 70 | php84-gd \ 71 | php84-gettext \ 72 | php84-gmp \ 73 | php84-iconv \ 74 | php84-imap \ 75 | php84-intl \ 76 | php84-ldap \ 77 | php84-litespeed \ 78 | php84-mbstring \ 79 | php84-mysqli \ 80 | php84-mysqlnd \ 81 | php84-odbc \ 82 | php84-opcache \ 83 | php84-openssl \ 84 | php84-pcntl \ 85 | php84-pdo \ 86 | php84-pdo_dblib \ 87 | php84-pdo_mysql \ 88 | php84-pdo_odbc \ 89 | php84-pdo_pgsql \ 90 | php84-pdo_sqlite \ 91 | php84-pear \ 92 | php84-pecl-amqp \ 93 | php84-pecl-apcu \ 94 | php84-pecl-ast \ 95 | php84-pecl-brotli \ 96 | php84-pecl-couchbase \ 97 | php84-pecl-ds \ 98 | php84-pecl-event \ 99 | php84-pecl-grpc \ 100 | php84-pecl-imagick \ 101 | php84-pecl-igbinary \ 102 | php84-pecl-maxminddb \ 103 | php84-pecl-memcache \ 104 | php84-pecl-memcached \ 105 | php84-pecl-mongodb \ 106 | php84-pecl-msgpack \ 107 | php84-pecl-opentelemetry \ 108 | php84-pecl-pcov \ 109 | php84-pecl-psr \ 110 | php84-pecl-rdkafka \ 111 | php84-pecl-redis \ 112 | php84-pecl-smbclient \ 113 | php84-pecl-ssh2 \ 114 | php84-pecl-swoole \ 115 | php84-pecl-uploadprogress \ 116 | php84-pecl-xdebug \ 117 | php84-pecl-xhprof \ 118 | php84-pecl-xhprof-assets \ 119 | php84-pecl-yaml \ 120 | php84-pecl-zstd \ 121 | php84-pgsql \ 122 | php84-phar \ 123 | php84-posix \ 124 | php84-session \ 125 | php84-shmop \ 126 | php84-simplexml \ 127 | php84-snmp \ 128 | php84-soap \ 129 | php84-sockets \ 130 | php84-sodium \ 131 | php84-sqlite3 \ 132 | php84-sysvmsg \ 133 | php84-sysvsem \ 134 | php84-sysvshm \ 135 | php84-tidy \ 136 | php84-tokenizer \ 137 | php84-xml \ 138 | php84-xmlreader \ 139 | php84-xmlwriter \ 140 | php84-xsl \ 141 | php84-zip \ 142 | " && \ 143 | \ 144 | export PHP_8_3_RUN_DEPS=" \ 145 | gnu-libiconv \ 146 | mariadb-connector-c \ 147 | php83 \ 148 | php83-bcmath \ 149 | php83-bz2 \ 150 | php83-calendar \ 151 | php83-common \ 152 | php83-ctype \ 153 | php83-curl \ 154 | php83-dba \ 155 | php83-dom \ 156 | php83-embed \ 157 | php83-enchant \ 158 | php83-exif \ 159 | php83-ffi \ 160 | php83-fileinfo \ 161 | php83-fpm \ 162 | php83-ftp \ 163 | php83-gd \ 164 | php83-gettext \ 165 | php83-gmp \ 166 | php83-iconv \ 167 | php83-imap \ 168 | php83-intl \ 169 | php83-ldap \ 170 | php83-litespeed \ 171 | php83-mbstring \ 172 | php83-mysqli \ 173 | php83-mysqlnd \ 174 | php83-odbc \ 175 | php83-opcache \ 176 | php83-openssl \ 177 | php83-pcntl \ 178 | php83-pdo \ 179 | php83-pdo_dblib \ 180 | php83-pdo_mysql \ 181 | php83-pdo_odbc \ 182 | php83-pdo_pgsql \ 183 | php83-pdo_sqlite \ 184 | php83-pear \ 185 | php83-pecl-amqp \ 186 | php83-pecl-apcu \ 187 | php83-pecl-ast \ 188 | php83-pecl-brotli \ 189 | php83-pecl-couchbase \ 190 | php83-pecl-ds \ 191 | php83-pecl-event \ 192 | php83-pecl-grpc \ 193 | php83-pecl-imagick \ 194 | php83-pecl-igbinary \ 195 | php83-pecl-maxminddb \ 196 | php83-pecl-memcache \ 197 | php83-pecl-memcached \ 198 | php83-pecl-mongodb \ 199 | php83-pecl-msgpack \ 200 | php83-pecl-opentelemetry \ 201 | php83-pecl-pcov \ 202 | php83-pecl-psr \ 203 | php83-pecl-rdkafka \ 204 | php83-pecl-redis \ 205 | php83-pecl-smbclient \ 206 | php83-pecl-ssh2 \ 207 | php83-pecl-swoole \ 208 | php83-pecl-uploadprogress \ 209 | php83-pecl-xdebug \ 210 | php83-pecl-xhprof \ 211 | php83-pecl-xhprof-assets \ 212 | php83-pecl-yaml \ 213 | php83-pecl-zstd \ 214 | php83-pgsql \ 215 | php83-phar \ 216 | php83-posix \ 217 | php83-pspell \ 218 | php83-session \ 219 | php83-shmop \ 220 | php83-simplexml \ 221 | php83-snmp \ 222 | php83-soap \ 223 | php83-sockets \ 224 | php83-sodium \ 225 | php83-sqlite3 \ 226 | php83-sysvmsg \ 227 | php83-sysvsem \ 228 | php83-sysvshm \ 229 | php83-tidy \ 230 | php83-tokenizer \ 231 | php83-xml \ 232 | php83-xmlreader \ 233 | php83-xmlwriter \ 234 | php83-xsl \ 235 | php83-zip \ 236 | " && \ 237 | \ 238 | export PHP_8_2_RUN_DEPS=" \ 239 | gnu-libiconv \ 240 | mariadb-connector-c \ 241 | php82 \ 242 | php82-bcmath \ 243 | php82-bz2 \ 244 | php82-calendar \ 245 | php82-common \ 246 | php82-ctype \ 247 | php82-curl \ 248 | php82-dba \ 249 | php82-dom \ 250 | php82-embed \ 251 | php82-enchant \ 252 | php82-exif \ 253 | php82-ffi \ 254 | php82-fileinfo \ 255 | php82-fpm \ 256 | php82-ftp \ 257 | php82-gd \ 258 | php82-gettext \ 259 | php82-gmp \ 260 | php82-iconv \ 261 | php82-imap \ 262 | php82-intl \ 263 | php82-ldap \ 264 | php82-litespeed \ 265 | php82-mbstring \ 266 | php82-mysqli \ 267 | php82-mysqlnd \ 268 | php82-odbc \ 269 | php82-opcache \ 270 | php82-openssl \ 271 | php82-pcntl \ 272 | php82-pdo \ 273 | php82-pdo_dblib \ 274 | php82-pdo_mysql \ 275 | php82-pdo_odbc \ 276 | php82-pdo_pgsql \ 277 | php82-pdo_sqlite \ 278 | php82-pear \ 279 | php82-pecl-amqp \ 280 | php82-pecl-apcu \ 281 | php82-pecl-ast \ 282 | php82-pecl-brotli \ 283 | php82-pecl-couchbase \ 284 | php82-pecl-decimal \ 285 | php82-pecl-ds \ 286 | php82-pecl-event \ 287 | php82-pecl-grpc \ 288 | php82-pecl-igbinary \ 289 | php82-pecl-imagick \ 290 | php82-pecl-lzf \ 291 | php82-pecl-mailparse \ 292 | php82-pecl-maxminddb \ 293 | php82-pecl-mcrypt \ 294 | php82-pecl-memcache \ 295 | php82-pecl-memcached \ 296 | php82-pecl-mongodb \ 297 | php82-pecl-msgpack \ 298 | php82-pecl-opentelemetry \ 299 | php82-pecl-pcov \ 300 | php82-pecl-protobuf \ 301 | php82-pecl-psr \ 302 | php82-pecl-rdkafka \ 303 | php82-pecl-redis \ 304 | php82-pecl-smbclient \ 305 | php82-pecl-ssh2 \ 306 | php82-pecl-swoole \ 307 | php82-pecl-timezonedb \ 308 | php82-pecl-uploadprogress \ 309 | php82-pecl-uuid \ 310 | php82-pecl-vips \ 311 | php82-pecl-xdebug \ 312 | php82-pecl-xhprof \ 313 | php82-pecl-xhprof-assets \ 314 | php82-pecl-xlswriter \ 315 | php82-pecl-yaml \ 316 | php82-pecl-zstd \ 317 | php82-pgsql \ 318 | php82-phar \ 319 | php82-posix \ 320 | php82-pspell \ 321 | php82-session \ 322 | php82-shmop \ 323 | php82-simplexml \ 324 | php82-snmp \ 325 | php82-soap \ 326 | php82-sockets \ 327 | php82-sodium \ 328 | php82-sqlite3 \ 329 | php82-sysvmsg \ 330 | php82-sysvsem \ 331 | php82-sysvshm \ 332 | php82-tidy \ 333 | php82-tokenizer \ 334 | php82-xml \ 335 | php82-xmlreader \ 336 | php82-xmlwriter \ 337 | php82-xsl \ 338 | php82-zip \ 339 | " && \ 340 | export PHP_8_1_RUN_DEPS=" \ 341 | gnu-libiconv \ 342 | mariadb-connector-c \ 343 | php81 \ 344 | php81-bcmath \ 345 | php81-bz2 \ 346 | php81-calendar \ 347 | php81-common \ 348 | php81-ctype \ 349 | php81-curl \ 350 | php81-dba \ 351 | php81-dom \ 352 | php81-embed \ 353 | php81-enchant \ 354 | php81-exif \ 355 | php81-ffi \ 356 | php81-fileinfo \ 357 | php81-fpm \ 358 | php81-ftp \ 359 | php81-gd \ 360 | php81-gettext \ 361 | php81-gmp \ 362 | php81-iconv \ 363 | php81-imap \ 364 | php81-intl \ 365 | php81-ldap \ 366 | php81-litespeed \ 367 | php81-mbstring \ 368 | php81-mysqli \ 369 | php81-mysqlnd \ 370 | php81-odbc \ 371 | php81-opcache \ 372 | php81-openssl \ 373 | php81-pcntl \ 374 | php81-pdo \ 375 | php81-pdo_dblib \ 376 | php81-pdo_mysql \ 377 | php81-pdo_odbc \ 378 | php81-pdo_pgsql \ 379 | php81-pdo_sqlite \ 380 | php81-pear \ 381 | php81-pecl-amqp \ 382 | php81-pecl-apcu \ 383 | php81-pecl-ast \ 384 | php81-pecl-brotli \ 385 | php81-pecl-couchbase \ 386 | php81-pecl-decimal \ 387 | php81-pecl-ds \ 388 | php81-pecl-event \ 389 | php81-pecl-igbinary \ 390 | php81-pecl-imagick \ 391 | php81-pecl-luasandbox \ 392 | php81-pecl-lzf \ 393 | php81-pecl-mailparse \ 394 | php81-pecl-maxminddb \ 395 | php81-pecl-mcrypt \ 396 | php81-pecl-memcache \ 397 | php81-pecl-memcached \ 398 | php81-pecl-mongodb \ 399 | php81-pecl-msgpack \ 400 | php81-pecl-opentelemetry \ 401 | php81-pecl-pcov \ 402 | php81-pecl-protobuf \ 403 | php81-pecl-psr \ 404 | php81-pecl-rdkafka \ 405 | php81-pecl-redis \ 406 | php81-pecl-smbclient \ 407 | php81-pecl-ssh2 \ 408 | php81-pecl-swoole \ 409 | php81-pecl-uploadprogress \ 410 | php81-pecl-uuid \ 411 | php81-pecl-vips \ 412 | php81-pecl-xdebug \ 413 | php81-pecl-xhprof \ 414 | php81-pecl-xhprof-assets \ 415 | php81-pecl-yaml \ 416 | php81-pecl-zstd \ 417 | php81-pgsql \ 418 | php81-phar \ 419 | php81-posix \ 420 | php81-pspell \ 421 | php81-session \ 422 | php81-shmop \ 423 | php81-simplexml \ 424 | php81-snmp \ 425 | php81-soap \ 426 | php81-sockets \ 427 | php81-sodium \ 428 | php81-sqlite3 \ 429 | php81-sysvmsg \ 430 | php81-sysvsem \ 431 | php81-sysvshm \ 432 | php81-tidy \ 433 | php81-tokenizer \ 434 | php81-xml \ 435 | php81-xmlreader \ 436 | php81-xmlwriter \ 437 | php81-xsl \ 438 | php81-zip \ 439 | " && \ 440 | \ 441 | export PHP_8_0_RUN_DEPS=" \ 442 | gnu-libiconv \ 443 | mariadb-connector-c \ 444 | php8 \ 445 | php8-bcmath \ 446 | php8-brotli \ 447 | php8-bz2 \ 448 | php8-calendar \ 449 | php8-common \ 450 | php8-ctype \ 451 | php8-curl \ 452 | php8-dba \ 453 | php8-dom \ 454 | php8-embed \ 455 | php8-enchant \ 456 | php8-exif \ 457 | php8-ffi \ 458 | php8-fileinfo \ 459 | php8-fpm \ 460 | php8-ftp \ 461 | php8-gd \ 462 | php8-gettext \ 463 | php8-gmp \ 464 | php8-iconv \ 465 | php8-imap \ 466 | php8-intl \ 467 | php8-ldap \ 468 | php8-litespeed \ 469 | php8-mbstring \ 470 | php8-mysqli \ 471 | php8-mysqlnd \ 472 | php8-odbc \ 473 | php8-opcache \ 474 | php8-openssl \ 475 | php8-pcntl \ 476 | php8-pdo \ 477 | php8-pdo_dblib \ 478 | php8-pdo_mysql \ 479 | php8-pdo_odbc \ 480 | php8-pdo_pgsql \ 481 | php8-pdo_sqlite \ 482 | php8-pear \ 483 | php8-pecl-amqp \ 484 | php8-pecl-apcu \ 485 | php8-pecl-ast \ 486 | php8-pecl-couchbase \ 487 | php8-pecl-event \ 488 | php8-pecl-igbinary \ 489 | php8-pecl-imagick \ 490 | php8-pecl-lzf \ 491 | php8-pecl-mailparse \ 492 | php8-pecl-maxminddb \ 493 | php8-pecl-mcrypt \ 494 | php8-pecl-memcache \ 495 | php8-pecl-memcached \ 496 | php8-pecl-mongodb \ 497 | php8-pecl-msgpack \ 498 | php8-pecl-oauth \ 499 | php8-pecl-protobuf \ 500 | php8-pecl-psr \ 501 | php8-pecl-rdkafka \ 502 | php8-pecl-redis \ 503 | php8-pecl-ssh2 \ 504 | php8-pecl-swoole \ 505 | php8-pecl-timezonedb \ 506 | php8-pecl-uploadprogress \ 507 | php8-pecl-uuid \ 508 | php8-pecl-vips \ 509 | php8-pecl-xdebug \ 510 | php8-pecl-xhprof \ 511 | php8-pecl-xhprof-assets \ 512 | php8-pecl-yaml \ 513 | php8-pecl-zstd \ 514 | php8-pgsql \ 515 | php8-phar \ 516 | php8-posix \ 517 | php8-pspell \ 518 | php8-session \ 519 | php8-shmop \ 520 | php8-simplexml \ 521 | php8-snmp \ 522 | php8-soap \ 523 | php8-sockets \ 524 | php8-sodium \ 525 | php8-sqlite3 \ 526 | php8-sysvmsg \ 527 | php8-sysvsem \ 528 | php8-sysvshm \ 529 | php8-tideways_xhprof \ 530 | php8-tidy \ 531 | php8-tokenizer \ 532 | php8-xml \ 533 | php8-xmlreader \ 534 | php8-xmlwriter \ 535 | php8-xsl \ 536 | php8-zip \ 537 | " && \ 538 | \ 539 | export PHP_7_4_RUN_DEPS=" \ 540 | mariadb-connector-c \ 541 | php7 \ 542 | php7-bcmath \ 543 | php7-brotli \ 544 | php7-bz2 \ 545 | php7-calendar \ 546 | php7-common \ 547 | php7-ctype \ 548 | php7-curl \ 549 | php7-dba \ 550 | php7-dom \ 551 | php7-embed \ 552 | php7-enchant \ 553 | php7-exif \ 554 | php7-ffi \ 555 | php7-fileinfo \ 556 | php7-fpm \ 557 | php7-ftp \ 558 | php7-gd \ 559 | php7-gettext \ 560 | php7-gmp \ 561 | php7-iconv \ 562 | php7-imap \ 563 | php7-intl \ 564 | php7-json \ 565 | php7-ldap \ 566 | php7-mbstring \ 567 | php7-mysqli \ 568 | php7-mysqlnd \ 569 | php7-odbc \ 570 | php7-opcache \ 571 | php7-openssl \ 572 | php7-pcntl \ 573 | php7-pdo \ 574 | php7-pdo_dblib \ 575 | php7-pdo_mysql \ 576 | php7-pdo_odbc \ 577 | php7-pdo_pgsql \ 578 | php7-pdo_sqlite \ 579 | php7-pear \ 580 | php7-pecl-amqp \ 581 | php7-pecl-apcu \ 582 | php7-pecl-ast \ 583 | php7-pecl-couchbase \ 584 | php7-pecl-event \ 585 | php7-pecl-gmagick \ 586 | php7-pecl-imagick \ 587 | php7-pecl-igbinary \ 588 | php7-pecl-lzf \ 589 | php7-pecl-mailparse \ 590 | php7-pecl-maxminddb \ 591 | php7-pecl-mcrypt \ 592 | php7-pecl-memcache \ 593 | php7-pecl-memcached \ 594 | php7-pecl-mongodb \ 595 | php7-pecl-msgpack \ 596 | php7-pecl-oauth \ 597 | php7-pecl-protobuf \ 598 | php7-pecl-psr \ 599 | php7-pecl-redis \ 600 | php7-pecl-ssh2 \ 601 | php7-pecl-timezonedb \ 602 | php7-pecl-uploadprogress \ 603 | php7-pecl-uuid \ 604 | php7-pecl-vips \ 605 | php7-pecl-xdebug \ 606 | php7-pecl-xhprof \ 607 | php7-pecl-xhprof-assets \ 608 | php7-pecl-yaml \ 609 | php7-pecl-zmq \ 610 | php7-pgsql \ 611 | php7-phalcon \ 612 | php7-phar \ 613 | php7-posix \ 614 | php7-pspell \ 615 | php7-session \ 616 | php7-shmop \ 617 | php7-simplexml \ 618 | php7-snmp \ 619 | php7-soap \ 620 | php7-sockets \ 621 | php7-sodium \ 622 | php7-sqlite3 \ 623 | php7-tidy \ 624 | php7-tokenizer \ 625 | php7-xml \ 626 | php7-xmlreader \ 627 | php7-xmlrpc \ 628 | php7-xmlwriter \ 629 | php7-xsl \ 630 | php7-zip \ 631 | " && \ 632 | \ 633 | export PHP_7_3_RUN_DEPS=" \ 634 | mariadb-connector-c \ 635 | php7 \ 636 | php7-bcmath \ 637 | php7-brotli \ 638 | php7-bz2 \ 639 | php7-calendar \ 640 | php7-common \ 641 | php7-ctype \ 642 | php7-curl \ 643 | php7-dba \ 644 | php7-dom \ 645 | php7-embed \ 646 | php7-enchant \ 647 | php7-exif \ 648 | php7-fileinfo \ 649 | php7-fpm \ 650 | php7-ftp \ 651 | php7-gd \ 652 | php7-gettext \ 653 | php7-gmp \ 654 | php7-iconv \ 655 | php7-imap \ 656 | php7-intl \ 657 | php7-json \ 658 | php7-ldap \ 659 | php7-litespeed \ 660 | php7-maxminddb \ 661 | php7-mbstring \ 662 | php7-mysqli \ 663 | php7-mysqlnd \ 664 | php7-odbc \ 665 | php7-opcache \ 666 | php7-openssl \ 667 | php7-pcntl \ 668 | php7-pdo \ 669 | php7-pdo_dblib \ 670 | php7-pdo_mysql \ 671 | php7-pdo_odbc \ 672 | php7-pdo_pgsql \ 673 | php7-pdo_sqlite \ 674 | php7-pear \ 675 | php7-pecl-amqp \ 676 | php7-pecl-apcu \ 677 | php7-pecl-ast \ 678 | php7-pecl-couchbase \ 679 | php7-pecl-event \ 680 | php7-pecl-gmagick \ 681 | php7-pecl-igbinary \ 682 | php7-pecl-imagick \ 683 | php7-pecl-lzf \ 684 | php7-pecl-mailparse \ 685 | php7-pecl-mcrypt \ 686 | php7-pecl-memcache \ 687 | php7-pecl-memcached \ 688 | php7-pecl-msgpack \ 689 | php7-pecl-oauth \ 690 | php7-pecl-protobuf \ 691 | php7-pecl-psr \ 692 | php7-pecl-redis \ 693 | php7-pecl-ssh2 \ 694 | php7-pecl-timezonedb \ 695 | php7-pecl-uploadprogress \ 696 | php7-pecl-uuid \ 697 | php7-pecl-vips \ 698 | php7-pecl-xdebug \ 699 | php7-pecl-xhprof \ 700 | php7-pecl-yaml \ 701 | php7-pecl-zmq \ 702 | php7-pgsql \ 703 | php7-phalcon \ 704 | php7-phar \ 705 | php7-posix \ 706 | php7-pspell \ 707 | php7-recode \ 708 | php7-session \ 709 | php7-shmop \ 710 | php7-simplexml \ 711 | php7-snmp \ 712 | php7-soap \ 713 | php7-sockets \ 714 | php7-sodium \ 715 | php7-sqlite3 \ 716 | php7-tidy \ 717 | php7-tokenizer \ 718 | php7-wddx \ 719 | php7-xml \ 720 | php7-xmlreader \ 721 | php7-xmlrpc \ 722 | php7-xmlwriter \ 723 | php7-xsl \ 724 | php7-zip \ 725 | " && \ 726 | \ 727 | export PHP_7_2_RUN_DEPS=" \ 728 | php7 \ 729 | php7-bcmath \ 730 | php7-bz2 \ 731 | php7-calendar \ 732 | php7-common \ 733 | php7-ctype \ 734 | php7-curl \ 735 | php7-dba \ 736 | php7-dom \ 737 | php7-embed \ 738 | php7-enchant \ 739 | php7-exif \ 740 | php7-fileinfo \ 741 | php7-fpm \ 742 | php7-ftp \ 743 | php7-gd \ 744 | php7-gettext \ 745 | php7-gmp \ 746 | php7-iconv \ 747 | php7-imap \ 748 | php7-intl \ 749 | php7-json \ 750 | php7-ldap \ 751 | php7-litespeed \ 752 | php7-mbstring \ 753 | php7-mysqli \ 754 | php7-mysqlnd \ 755 | php7-odbc \ 756 | php7-opcache \ 757 | php7-openssl \ 758 | php7-pcntl \ 759 | php7-pdo \ 760 | php7-pdo_dblib \ 761 | php7-pdo_mysql \ 762 | php7-pdo_odbc \ 763 | php7-pdo_pgsql \ 764 | php7-pdo_sqlite \ 765 | php7-pear \ 766 | php7-pear-auth_sasl \ 767 | php7-pear-auth_sasl2 \ 768 | php7-pear-mail_mime \ 769 | php7-pear-mdb2_driver_mysql \ 770 | php7-pear-mdb2_driver_pgsql \ 771 | php7-pear-net_sieve \ 772 | php7-pear-net_smtp \ 773 | php7-pear-net_socket \ 774 | php7-pecl-amqp \ 775 | php7-pecl-apcu \ 776 | php7-pecl-ast \ 777 | php7-pecl-couchbase \ 778 | php7-pecl-event \ 779 | php7-pecl-gmagick \ 780 | php7-pecl-igbinary \ 781 | php7-pecl-imagick \ 782 | php7-pecl-lzf \ 783 | php7-pecl-mailparse \ 784 | php7-pecl-mcrypt \ 785 | php7-pecl-memcached \ 786 | php7-pecl-mongodb \ 787 | php7-pecl-oauth \ 788 | php7-pecl-redis \ 789 | php7-pecl-timezonedb \ 790 | php7-pecl-xdebug \ 791 | php7-pecl-yaml \ 792 | php7-pecl-zmq \ 793 | php7-pgsql \ 794 | php7-phalcon \ 795 | php7-phar \ 796 | php7-posix \ 797 | php7-pspell \ 798 | php7-recode \ 799 | php7-session \ 800 | php7-shmop \ 801 | php7-simplexml \ 802 | php7-snmp \ 803 | php7-soap \ 804 | php7-sockets \ 805 | php7-sodium \ 806 | php7-sqlite3 \ 807 | php7-tidy \ 808 | php7-tokenizer \ 809 | php7-wddx \ 810 | php7-xml \ 811 | php7-xmlreader \ 812 | php7-xmlrpc \ 813 | php7-xmlwriter \ 814 | php7-xsl \ 815 | php7-zip \ 816 | " && \ 817 | \ 818 | export PHP_7_1_RUN_DEPS=" \ 819 | php7 \ 820 | php7-amqp \ 821 | php7-apcu \ 822 | php7-bcmath \ 823 | php7-bz2 \ 824 | php7-calendar \ 825 | php7-common \ 826 | php7-ctype \ 827 | php7-curl \ 828 | php7-dba \ 829 | php7-dom \ 830 | php7-embed \ 831 | php7-enchant \ 832 | php7-exif \ 833 | php7-fileinfo \ 834 | php7-fpm \ 835 | php7-ftp \ 836 | php7-gd \ 837 | php7-gettext \ 838 | php7-gmp \ 839 | php7-iconv \ 840 | php7-imagick \ 841 | php7-imap \ 842 | php7-intl \ 843 | php7-json \ 844 | php7-ldap \ 845 | php7-litespeed \ 846 | php7-mailparse \ 847 | php7-mbstring \ 848 | php7-mcrypt \ 849 | php7-memcached \ 850 | php7-mysqli \ 851 | php7-mysqlnd \ 852 | php7-oauth \ 853 | php7-odbc \ 854 | php7-opcache \ 855 | php7-openssl \ 856 | php7-pcntl \ 857 | php7-pdo \ 858 | php7-pdo_dblib \ 859 | php7-pdo_mysql \ 860 | php7-pdo_odbc \ 861 | php7-pdo_pgsql \ 862 | php7-pdo_sqlite \ 863 | php7-pear \ 864 | php7-pear-auth_sasl \ 865 | php7-pear-auth_sasl2 \ 866 | php7-pear-mail_mime \ 867 | php7-pear-mdb2_driver_mysql \ 868 | php7-pear-mdb2_driver_pgsql \ 869 | php7-pear-net_smtp \ 870 | php7-pear-net_socket \ 871 | php7-pgsql \ 872 | php7-phar \ 873 | php7-posix \ 874 | php7-pspell \ 875 | php7-recode \ 876 | php7-redis \ 877 | php7-session \ 878 | php7-shmop \ 879 | php7-simplexml \ 880 | php7-snmp \ 881 | php7-soap \ 882 | php7-sockets \ 883 | php7-sqlite3 \ 884 | php7-ssh2 \ 885 | php7-tidy \ 886 | php7-tokenizer \ 887 | php7-wddx \ 888 | php7-xdebug \ 889 | php7-xml \ 890 | php7-xmlreader \ 891 | php7-xmlrpc \ 892 | php7-xmlwriter \ 893 | php7-xsl \ 894 | php7-zip \ 895 | php7-zmq \ 896 | " && \ 897 | \ 898 | export PHP_7_0_RUN_DEPS=" \ 899 | php7 \ 900 | php7-apcu \ 901 | php7-bcmath \ 902 | php7-bz2 \ 903 | php7-calendar \ 904 | php7-common \ 905 | php7-ctype \ 906 | php7-curl \ 907 | php7-dba \ 908 | php7-dom \ 909 | php7-embed \ 910 | php7-enchant \ 911 | php7-exif \ 912 | php7-fpm \ 913 | php7-ftp \ 914 | php7-gd \ 915 | php7-gettext \ 916 | php7-gmp \ 917 | php7-iconv \ 918 | php7-imap \ 919 | php7-intl \ 920 | php7-json \ 921 | php7-ldap \ 922 | php7-litespeed \ 923 | php7-mbstring \ 924 | php7-mcrypt \ 925 | php7-mysqli \ 926 | php7-mysqlnd \ 927 | php7-odbc \ 928 | php7-opcache \ 929 | php7-openssl \ 930 | php7-pcntl \ 931 | php7-pdo \ 932 | php7-pdo_dblib \ 933 | php7-pdo_mysql \ 934 | php7-pdo_odbc \ 935 | php7-pdo_pgsql \ 936 | php7-pdo_sqlite \ 937 | php7-pear \ 938 | php7-pgsql \ 939 | php7-phar \ 940 | php7-posix \ 941 | php7-pspell \ 942 | php7-session \ 943 | php7-shmop \ 944 | php7-snmp \ 945 | php7-soap \ 946 | php7-sockets \ 947 | php7-sqlite3 \ 948 | php7-tidy \ 949 | php7-wddx \ 950 | php7-xdebug \ 951 | php7-xml \ 952 | php7-xmlreader \ 953 | php7-xmlrpc \ 954 | php7-xsl \ 955 | php7-zip \ 956 | php7-zlib \ 957 | " && \ 958 | \ 959 | export PHP_5_6_RUN_DEPS=" \ 960 | php5 \ 961 | php5-apcu \ 962 | php5-bcmath \ 963 | php5-bz2 \ 964 | php5-calendar \ 965 | php5-cli \ 966 | php5-common \ 967 | php5-ctype \ 968 | php5-curl \ 969 | php5-dba \ 970 | php5-dom \ 971 | php5-embed \ 972 | php5-enchant \ 973 | php5-exif \ 974 | php5-fpm \ 975 | php5-ftp \ 976 | php5-gd \ 977 | php5-gettext \ 978 | php5-gmp \ 979 | php5-iconv \ 980 | php5-imap \ 981 | php5-intl \ 982 | php5-json \ 983 | php5-ldap \ 984 | php5-mcrypt \ 985 | php5-mssql \ 986 | php5-mysql \ 987 | php5-mysqli \ 988 | php5-odbc \ 989 | php5-opcache \ 990 | php5-openssl \ 991 | php5-pcntl \ 992 | php5-pdo \ 993 | php5-pdo_dblib \ 994 | php5-pdo_mysql \ 995 | php5-pdo_odbc \ 996 | php5-pdo_pgsql \ 997 | php5-pdo_sqlite \ 998 | php5-pear \ 999 | php5-pgsql \ 1000 | php5-phar \ 1001 | php5-posix \ 1002 | php5-pspell \ 1003 | php5-shmop \ 1004 | php5-snmp \ 1005 | php5-soap \ 1006 | php5-sockets \ 1007 | php5-sqlite3 \ 1008 | #php5-suhosin \ 1009 | php5-wddx \ 1010 | php5-xml \ 1011 | php5-xmlreader \ 1012 | php5-xmlrpc \ 1013 | php5-xsl \ 1014 | php5-zip \ 1015 | " && \ 1016 | \ 1017 | source /assets/functions/00-container && \ 1018 | set -x && \ 1019 | package update && \ 1020 | package upgrade && \ 1021 | package install .php-build-deps \ 1022 | build-base \ 1023 | gpgme-dev \ 1024 | php${php_folder}-dev \ 1025 | && \ 1026 | \ 1027 | package install .php-run-deps \ 1028 | ca-certificates \ 1029 | git \ 1030 | gnupg \ 1031 | gpgme \ 1032 | openssl \ 1033 | mariadb-client \ 1034 | postgresql-client \ 1035 | $(printenv PHP_$(echo ${PHP_BASE} | sed 's|\.|_|g')_RUN_DEPS) \ 1036 | && \ 1037 | \ 1038 | ### PHP Setup 1039 | ## Temp Fix for graphicsmagick 1040 | if [ -f "/etc/php${php_folder}/*magick*.ini" ]; then mv /etc/php${php_folder}/conf.d/*magick*.ini /tmp; fi; \ 1041 | sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php${php_folder}/php.ini && \ 1042 | if [ -f "/usr/sbin/php-fpm${php_folder}" ] ; then ln -sf /usr/sbin/php-fpm${php_folder} /usr/sbin/php-fpm ; fi ; \ 1043 | if [ -f "/usr/bin/php${php_folder}" ] ; then ln -sf /usr/bin/php${php_folder} /usr/sbin/php ; fi ; \ 1044 | if [ -f "/usr/bin/pecl${php_folder}" ] ; then ln -sf /usr/bin/pecl${php_folder} /usr/sbin/pecl; fi ; \ 1045 | rm -rf /etc/logrotate.d/php* && \ 1046 | \ 1047 | ### Install PHP Composer 1048 | if [ "${PHP_BASE:0:1}" = "5" ] ; then echo "suhosin.executor.include.whitelist = phar" >> /etc/php${PHP_BASE:0:1}/php.ini ; fi; \ 1049 | curl -sSLk https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \ 1050 | if [ -f "/etc/php${php_folder}/*magick*.ini" ]; then mv /tmp/*magick.ini* /etc/php${php_folder}/conf.d/ ; fi ; \ 1051 | \ 1052 | ### Build Extra Extensions 1053 | if [ "${build_gnupg,,}" = "true" ] ; then \ 1054 | pecl install gnupg ; \ 1055 | echo "extension=gnupg.so" > /etc/php${php_folder}/conf.d/20-gnupg.ini ; \ 1056 | fi ; \ 1057 | mkdir -p /etc/php${php_folder}/mods-available/ && \ 1058 | #### Disabling any but core extensions - When using this image as a base for other images, you'll want to turn turn them on before running composer with the inverse of phpdisomd (phpenmod) to keep things clean 1059 | set +x && \ 1060 | for module in /etc/php${php_folder}/conf.d/*.ini; do if [ ! -L "${module}" ] ; then if [ "$(echo $(basename $module) | grep -c '^[0-9][0-9].*')" = "0" ] ; then mv "${module}" "$(dirname ${module})/20_$(basename ${module})" ; module="$(dirname ${module})/20_$(basename ${module})"; fi ; if ! grep -w -i -q ";priority" "$module"; then echo ";priority=$(basename $module .ini | cut -d _ -f1)" >> $module ; mv "${module}" /etc/php${php_folder}/mods-available/$(basename ${module} .ini | cut -c 4-).ini; fi; fi; done; \ 1061 | rm -rf /etc/php${php_folder}/conf.d/* && \ 1062 | sed -i "s|;priority=00|;priority=10|g" /etc/php${php_folder}/mods-available/opcache.ini && \ 1063 | php_env_plugins_enabled="$(set | sort | grep PHP_ENABLE_ | grep -i TRUE | cut -d _ -f 3 | cut -d = -f 1 | tr [A-Z] [a-z])" && \ 1064 | for module in $php_env_plugins_enabled ; do if [ -f "/etc/php${php_folder}/mods-available/${module}.ini" ] ; then priority=$(cat /etc/php${php_folder}/mods-available/${module}.ini | grep ";priority" | cut -d = -f2) ; ln -sf "/etc/php${php_folder}/mods-available/${module}.ini" /etc/php${php_folder}/conf.d/${priority}-${module}.ini ; fi ; done ; \ 1065 | if [ "${PHP_BASE:0:1}" != "8" ] ; then priority=$(cat /etc/php${PHP_BASE:0:1}/mods-available/json.ini | grep ";priority" | cut -d = -f2) ; ln -sf "/etc/php${PHP_BASE:0:1}/mods-available/json.ini" /etc/php${PHP_BASE:0:1}/conf.d/${priority}-json.ini ; fi ; \ 1066 | set -x && \ 1067 | \ 1068 | ### Cleanup 1069 | package remove .php-build-deps && \ 1070 | package cleanup && \ 1071 | rm -rf \ 1072 | /tmp/* \ 1073 | /usr/src/* \ 1074 | /var/log/* 1075 | 1076 | EXPOSE 9000 1077 | COPY install / 1078 | 1079 | -------------------------------------------------------------------------------- /Dockerfile.debian: -------------------------------------------------------------------------------- 1 | ARG DISTRO=debian 2 | ARG DISTRO_VARIANT=bookworm 3 | 4 | FROM docker.io/tiredofit/nginx:${DISTRO}-${DISTRO_VARIANT} 5 | LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" 6 | 7 | ARG PHP_BASE 8 | 9 | ENV PHP_BASE=${PHP_BASE:-"8.4"} \ 10 | PHP_ENABLE_APCU=TRUE \ 11 | PHP_ENABLE_BCMATH=TRUE \ 12 | PHP_ENABLE_BZ2=TRUE \ 13 | PHP_ENABLE_CTYPE=TRUE \ 14 | PHP_ENABLE_CURL=TRUE \ 15 | PHP_ENABLE_DOM=TRUE \ 16 | PHP_ENABLE_EXIF=TRUE \ 17 | PHP_ENABLE_FILEINFO=TRUE \ 18 | PHP_ENABLE_GD=TRUE \ 19 | PHP_ENABLE_ICONV=TRUE \ 20 | PHP_ENABLE_IMAP=TRUE \ 21 | PHP_ENABLE_INTL=TRUE \ 22 | PHP_ENABLE_MBSTRING=TRUE \ 23 | PHP_ENABLE_MYSQLI=TRUE \ 24 | PHP_ENABLE_MYSQLND=TRUE \ 25 | PHP_ENABLE_OPCACHE=TRUE \ 26 | PHP_ENABLE_OPENSSL=TRUE \ 27 | PHP_ENABLE_PDO=TRUE \ 28 | PHP_ENABLE_PDO_MYSQL=TRUE \ 29 | PHP_ENABLE_PGSQL=TRUE \ 30 | PHP_ENABLE_PHAR=TRUE \ 31 | PHP_ENABLE_SIMPLEXML=TRUE \ 32 | PHP_ENABLE_TOKENIZER=TRUE \ 33 | PHP_ENABLE_XML=TRUE \ 34 | PHP_ENABLE_XMLREADER=TRUE \ 35 | PHP_ENABLE_XMLWRITER=TRUE \ 36 | CONTAINER_ENABLE_MESSAGING=TRUE \ 37 | NGINX_ENABLE_CREATE_SAMPLE_HTML=FALSE \ 38 | IMAGE_NAME="tiredofit/nginx-php-fpm" \ 39 | IMAGE_REPO_URL="https://github.com/tiredofit/docker-nginx-php-fpm/" 40 | 41 | ### Dependency Installation 42 | RUN export PHP_7_3_RUN_DEPS=" \ 43 | php$PHP_BASE-apcu-bc \ 44 | php$PHP_BASE-http \ 45 | php$PHP_BASE-json \ 46 | php$PHP_BASE-mcrypt \ 47 | php$PHP_BASE-propro \ 48 | php$PHP_BASE-radius \ 49 | php$PHP_BASE-recode \ 50 | " && \ 51 | \ 52 | export PHP_7_4_RUN_DEPS=" \ 53 | php$PHP_BASE-apcu-bc \ 54 | php$PHP_BASE-http \ 55 | php$PHP_BASE-json \ 56 | php$PHP_BASE-mcrypt \ 57 | php$PHP_BASE-propro \ 58 | php$PHP_BASE-radius \ 59 | " && \ 60 | \ 61 | export PHP_8_0_RUN_DEPS=" \ 62 | php$PHP_BASE-http \ 63 | php$PHP_BASE-mcrypt \ 64 | " && \ 65 | \ 66 | export PHP_8_1_RUN_DEPS=" \ 67 | php$PHP_BASE-mcrypt \ 68 | " && \ 69 | \ 70 | export PHP_8_2_RUN_DEPS=" \ 71 | " && \ 72 | \ 73 | export PHP_8_3_RUN_DEPS=" \ 74 | " && \ 75 | \ 76 | export PHP_8_4_RUN_DEPS=" \ 77 | " && \ 78 | \ 79 | export PHP_ADDITIONAL_MODULES=" \ 80 | php$PHP_BASE-ast \ 81 | php$PHP_BASE-apcu \ 82 | php$PHP_BASE-gearman \ 83 | php$PHP_BASE-grpc \ 84 | php$PHP_BASE-imagick \ 85 | php$PHP_BASE-inotify \ 86 | php$PHP_BASE-mailparse \ 87 | php$PHP_BASE-maxminddb \ 88 | php$PHP_BASE-memcache \ 89 | php$PHP_BASE-memcached \ 90 | php$PHP_BASE-mongodb \ 91 | php$PHP_BASE-msgpack \ 92 | php$PHP_BASE-oauth \ 93 | php$PHP_BASE-pcov \ 94 | php-pear \ 95 | php$PHP_BASE-protobuf \ 96 | php$PHP_BASE-smbclient \ 97 | #php-sodium \ 98 | php$PHP_BASE-uuid \ 99 | php$PHP_BASE-xmlrpc \ 100 | php$PHP_BASE-zstd \ 101 | " && \ 102 | \ 103 | export PHP_RUN_DEPS=" \ 104 | php$PHP_BASE \ 105 | php$PHP_BASE-apcu \ 106 | php$PHP_BASE-bcmath \ 107 | php$PHP_BASE-bz2 \ 108 | php$PHP_BASE-cli \ 109 | php$PHP_BASE-common \ 110 | php$PHP_BASE-curl \ 111 | php$PHP_BASE-dba \ 112 | php$PHP_BASE-dev \ 113 | # php$PHP_BASE-embed \ 114 | php$PHP_BASE-enchant \ 115 | php$PHP_BASE-fpm \ 116 | php$PHP_BASE-gd \ 117 | php$PHP_BASE-gmp \ 118 | php$PHP_BASE-igbinary \ 119 | php$PHP_BASE-imap \ 120 | php$PHP_BASE-interbase \ 121 | php$PHP_BASE-intl \ 122 | php$PHP_BASE-ldap \ 123 | php$PHP_BASE-memcached \ 124 | php$PHP_BASE-mbstring \ 125 | php$PHP_BASE-msgpack \ 126 | php$PHP_BASE-mysql \ 127 | php$PHP_BASE-odbc \ 128 | php$PHP_BASE-opcache \ 129 | php$PHP_BASE-pgsql \ 130 | php$PHP_BASE-pspell \ 131 | php$PHP_BASE-readline \ 132 | php$PHP_BASE-redis \ 133 | php$PHP_BASE-snmp \ 134 | php$PHP_BASE-soap \ 135 | php$PHP_BASE-sqlite3 \ 136 | php$PHP_BASE-tidy \ 137 | php$PHP_BASE-xdebug \ 138 | php$PHP_BASE-xml \ 139 | php$PHP_BASE-xmlrpc \ 140 | php$PHP_BASE-xsl \ 141 | php$PHP_BASE-zip \ 142 | " && \ 143 | source /assets/functions/00-container && \ 144 | set -x && \ 145 | curl -sSLk https://mariadb.org/mariadb_release_signing_key.asc | apt-key add - && \ 146 | mariadb_client_ver="$(curl -sSLk https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | grep "mariadb_server_version=mariadb-" | head -n 1 | cut -d = -f 2 | cut -d - -f 2)" && \ 147 | echo "deb https://mirror.its.dal.ca/mariadb/repo/${mariadb_client_ver}/debian $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') main" > /etc/apt/sources.list.d/mariadb.list && \ 148 | curl -sSLk https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \ 149 | echo "deb https://apt.postgresql.org/pub/repos/apt $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')')-pgdg main" > /etc/apt/sources.list.d/postgres.list && \ 150 | apt-key adv --fetch-keys https://packages.sury.org/php/apt.gpg && \ 151 | echo "deb https://packages.sury.org/php/ $(cat /etc/os-release |grep "VERSION=" | awk 'NR>1{print $1}' RS='(' FS=')') main" > /etc/apt/sources.list.d/php.list && \ 152 | package update && \ 153 | package upgrade -y && \ 154 | package install \ 155 | ca-certificates \ 156 | git \ 157 | mariadb-client \ 158 | openssl \ 159 | postgresql-client \ 160 | ${PHP_RUN_DEPS} \ 161 | $(printenv PHP$(echo ${PHP_BASE} | sed 's|\.|_|g')_RUN_DEPS) \ 162 | ${PHP_ADDITIONAL_MODULES} \ 163 | && \ 164 | \ 165 | ### Install PHP Composer 166 | curl -sSLk https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer && \ 167 | \ 168 | ### PHP Setup 169 | sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php/${PHP_BASE}/cli/php.ini && \ 170 | ln -s /usr/sbin/php-fpm${PHP_BASE} /usr/sbin/php-fpm && \ 171 | rm -rf /etc/logrotate.d/php* && \ 172 | update-alternatives --set php /usr/bin/php${PHP_BASE} && \ 173 | #### Disabling any but core extensions - When using this image as a base for other images, you'll want to turn turn them on before running composer with the inverse of phpdisomd (phpenmod) to keep things clean 174 | set +x && \ 175 | for f in /etc/php/${PHP_BASE}/mods-available/*.ini; do phpdismod $(basename $f .ini); done; \ 176 | php_env_plugins_enabled="$(set | sort | grep PHP_ENABLE_ | grep -i TRUE | cut -d _ -f 3 | cut -d = -f 1 | tr A-Z a-z)" && \ 177 | for module in $php_env_plugins_enabled ; do phpenmod ${module} ; done ; \ 178 | if [ "$PHP_BASE" = "7.3" ] || [ "$PHP_BASE" = "7.4" ]; then phpenmod json ; fi ; \ 179 | set -x && \ 180 | \ 181 | ### Cleaning up all the other PHP version configs 182 | cd /etc/php && \ 183 | find . -mindepth 1 -maxdepth 1 -type d -not -name ${PHP_BASE} -exec rm -rf '{}' \; && \ 184 | \ 185 | package cleanup && \ 186 | mkdir -p /var/log/nginx && \ 187 | rm -rf \ 188 | /root/.gnupg \ 189 | /tmp/* \ 190 | /usr/src/* \ 191 | /var/log/* 192 | 193 | EXPOSE 9000 194 | COPY install / 195 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2022 Dave Conroy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # github.com/tiredofit/docker-nginx-php-fpm 2 | 3 | [![GitHub release](https://img.shields.io/github/v/tag/tiredofit/docker-nginx-php-fpm?style=flat-square)](https://github.com/tiredofit/docker-nginx-php-fpm/releases/latest) 4 | [![Build Status](https://img.shields.io/github/actions/workflow/status/tiredofit/docker-nginx-php-fpm/main.yml?branch=main&style=flat-square)](https://github.com/tiredofit/docker-nginx-php-fpm/actions) 5 | [![Docker Stars](https://img.shields.io/docker/stars/tiredofit/nginx-php-fpm.svg?style=flat-square&logo=docker)](https://hub.docker.com/r/tiredofit/nginx-php-fpm/) 6 | [![Docker Pulls](https://img.shields.io/docker/pulls/tiredofit/nginx-php-fpm.svg?style=flat-square&logo=docker)](https://hub.docker.com/r/tiredofit/nginx-php-fpm/) 7 | [![Become a sponsor](https://img.shields.io/badge/sponsor-tiredofit-181717.svg?logo=github&style=flat-square)](https://github.com/sponsors/tiredofit) 8 | [![Paypal Donate](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal&style=flat-square)](https://www.paypal.me/tiredofit) 9 | 10 | * * * 11 | 12 | 13 | ## About 14 | 15 | This repository will build a [Nginx](https://www.nginx.org) w/[PHP-FPM](https://php.net) docker image, suitable for serving PHP scripts, or utilizing as a base image for installing additional software. 16 | 17 | * Tracking PHP 5.3-8.3 18 | * Easily enable / disable extensions based on your use case 19 | * Automatic Log rotation 20 | * Composer Included 21 | * XDebug capability 22 | * Caching via APC, opcache 23 | * Includes client libraries for [MariaDB](https://www.mariadb.org) and [Postgresql](https://www.postgresql.org) 24 | 25 | ## Maintainer 26 | 27 | - [Dave Conroy](http://github/tiredofit/) 28 | 29 | ## Table of Contents 30 | 31 | - [About](#about) 32 | - [Maintainer](#maintainer) 33 | - [Table of Contents](#table-of-contents) 34 | - [Prerequisites and Assumptions](#prerequisites-and-assumptions) 35 | - [Installation](#installation) 36 | - [Build from Source](#build-from-source) 37 | - [Prebuilt Images](#prebuilt-images) 38 | - [Multi Architecture](#multi-architecture) 39 | - [Configuration](#configuration) 40 | - [Quick Start](#quick-start) 41 | - [Persistent Storage](#persistent-storage) 42 | - [Environment Variables](#environment-variables) 43 | - [Base Images used](#base-images-used) 44 | - [Container Options](#container-options) 45 | - [Enabling / Disabling Specific Extensions](#enabling--disabling-specific-extensions) 46 | - [Debug Options](#debug-options) 47 | - [Networking](#networking) 48 | - [Maintenance](#maintenance) 49 | - [Shell Access](#shell-access) 50 | - [PHP Extensions](#php-extensions) 51 | - [Maintenance Mode](#maintenance-mode) 52 | - [Contributions](#contributions) 53 | - [Support](#support) 54 | - [Usage](#usage) 55 | - [Bugfixes](#bugfixes) 56 | - [Feature Requests](#feature-requests) 57 | - [Updates](#updates) 58 | - [License](#license) 59 | - [References](#references) 60 | 61 | 62 | ## Prerequisites and Assumptions 63 | * Assumes you are using some sort of SSL terminating reverse proxy such as: 64 | * [Traefik](https://github.com/tiredofit/docker-traefik) 65 | * [Nginx](https://github.com/jc21/nginx-proxy-manager) 66 | * [Caddy](https://github.com/caddyserver/caddy) 67 | 68 | ## Installation 69 | 70 | ### Build from Source 71 | Clone this repository and build the image with `docker build -t (imagename) .` 72 | ### Prebuilt Images 73 | Builds of the image are available on [Docker Hub](https://hub.docker.com/r/tiredofit/nginx-php-fpm) 74 | 75 | ```bash 76 | docker pull docker.io/tiredofit/nginx-php-fpm:(imagetag) 77 | ``` 78 | 79 | Builds of the image are also available on the [Github Container Registry](https://github.com/tiredofit/docker-nginx-php-fpm/pkgs/container/docker-nginx-php-fpm) 80 | 81 | ``` 82 | docker pull ghcr.io/tiredofit/docker-nginx-php-fpm:(imagetag) 83 | ``` 84 | 85 | The following image tags are available along with their tagged release based on what's written in the [Changelog](CHANGELOG.md): 86 | 87 | | PHP version | Alpine Base | Tag | Debian Base | Tag | 88 | | ----------- | ----------- | -------------- | ----------- | ---------------------- | 89 | | latest | edge | `:alpine-edge` | | | 90 | | 8.4.x | 3.21 | `:8.3-alpine` | Bookworm | `:8.4-debian-bookworm` | 91 | | 8.3.x | 3.21 | `:8.3-alpine` | Bookworm | `:8.3-debian-bookworm` | 92 | | 8.2.x | 3.21 | `:8.2-alpine` | Bookworm | `:8.2-debian-bookworm` | 93 | | 8.1.x | 3.19 | `:8.1-alpine` | Bookworm | `:8.1-debian-bookworm` | 94 | | 8.0.x | 3.16 | `:8.0-alpine` | Bookworm | `:8.0-debian-bookworm` | 95 | | 7.4.x | 3.15 | `:7.4-alpine` | Bookworm | `:7.4-debian-bookworm` | 96 | | 7.3.x | 3.12 | `:7.3-alpine` | Bookworm | `:7.3-debian-bookworm` | 97 | | 7.2.x | 3.9 | `:7.2-alpine` | | | 98 | | 7.1.x | 3.7 | `:7.1-alpine` | | | 99 | | 7.0.x | 3.5 | `:7.0-alpine` | | | 100 | | 5.6.x | 3.8 | `:5.6-alpine` | | | 101 | | 5.5.x | 3.4 | `:5.5-latest` | | | 102 | | 5.3.x | 3.4 | `:5.3-latest` | | | 103 | 104 | #### Multi Architecture 105 | Images are built primarily for `amd64` architecture, and may also include builds for `arm/v7`, `arm64` and others. These variants are all unsupported. Consider [sponsoring](https://github.com/sponsors/tiredofit) my work so that I can work with various hardware. To see if this image supports multiple architecures, type `docker manifest (image):(tag)` 106 | 107 | ## Configuration 108 | 109 | ### Quick Start 110 | 111 | * The quickest way to get started is using [docker-compose](https://docs.docker.com/compose/). See the examples folder for a working [compose.yml](examples/compose.yml) that can be modified for development or production use. 112 | 113 | * Set various [environment variables](#environment-variables) to understand the capabilities of this image. 114 | * Map [persistent storage](#data-volumes) for access to configuration and data files for backup. 115 | 116 | The container starts up and reads from `/etc/nginx/nginx.conf` for some basic configuration and to listen on port 73 internally for Nginx Status responses. Configuration of websites are done in `/etc/services.available` with the filename pattern of `site.conf`. You must set an environment variable for `NGINX_SITE_ENABLED` if you have more than one configuration in there if you only want to enable one of the configurartions, otherwise it will enable all of them. Use `NGINX_SITE_ENABLED=null` to break a parent image declaration. 117 | 118 | Use this as a starting point for your site configurations: 119 | ````nginx 120 | server { 121 | ### Don't Touch This 122 | listen {{NGINX_LISTEN_PORT}}; 123 | server_name localhost; 124 | root {{NGINX_WEBROOT}}; 125 | 126 | ### Populate your custom directives here 127 | index index.php index.html index.htm; 128 | 129 | # Deny access to any files with a .php extension in the uploads directory 130 | location ~* /(?:uploads|files)/.*\.php$ { 131 | deny all; 132 | } 133 | 134 | location / { 135 | try_files \$uri \$uri/ /index.php?\$args; 136 | } 137 | 138 | ### Populate your custom directives here 139 | location ~ \.php(/|\$) { 140 | include /etc/nginx/snippets/php-fpm.conf; 141 | fastcgi_split_path_info ^(.+?\.php)(/.+)\$; 142 | fastcgi_param PATH_INFO \$fastcgi_path_info; 143 | fastcgi_index index.php; 144 | include fastcgi_params; 145 | fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; 146 | } 147 | 148 | ### Don't edit past here 149 | include /etc/nginx/snippets/site_optimization.conf; 150 | include /etc/nginx/snippets/exploit_protection.conf; 151 | } 152 | ```` 153 | 154 | ### Persistent Storage 155 | 156 | The container starts up and reads from `/etc/nginx/nginx.conf` for some basic configuration and to listen on port 73 internally for Nginx Status responses. `/etc/nginx/conf.d` contains a sample configuration file that can be used to customize a nginx server block. 157 | 158 | The following directories are used for configuration and can be mapped for persistent storage. 159 | 160 | | Directory | Description | 161 | | ----------- | -------------------------- | 162 | | `/www/html` | Root Directory | 163 | | `/www/logs` | Nginx and php-fpm logfiles | 164 | 165 | * * * 166 | ### Environment Variables 167 | 168 | #### Base Images used 169 | 170 | This image relies on an [Alpine Linux](https://hub.docker.com/r/tiredofit/alpine) or [Debian Linux](https://hub.docker.com/r/tiredofit/debian) base image that relies on an [init system](https://github.com/just-containers/s6-overlay) for added capabilities. Outgoing SMTP capabilities are handlded via `msmtp`. Individual container performance monitoring is performed by [zabbix-agent](https://zabbix.org). Additional tools include: `bash`,`curl`,`less`,`logrotate`, `nano`. 171 | Be sure to view the following repositories to understand all the customizable options: 172 | 173 | | Image | Description | 174 | | ------------------------------------------------------ | -------------------------------------- | 175 | | [OS Base](https://github.com/tiredofit/docker-alpine/) | Customized Image based on Alpine Linux | 176 | | [Nginx](https://github.com/tiredofit/docker-nginx/) | Nginx webserver | 177 | 178 | 179 | #### Container Options 180 | 181 | The container has an ability to work in 3 modes, `nginx-php-fpm` (default) is an All in One image with nginx and php-fpm working together, `nginx` will only utilize nginx however not the included php-fpm instance, allowing for connecting to multiple remote php-fpm backends, and finally `php-fpm` to operate PHP-FPM in standalone mode. 182 | 183 | 184 | | Parameter | Description | Default | 185 | | ------------------------ | ------------------------------------------------------------- | --------------- | 186 | | `PHP_FPM_CONTAINER_MODE` | Mode of running container `nginx-php-fpm`, `nginx`, `php-fpm` | `nginx-php-fpm` | 187 | 188 | When `PHP_FPM_CONTAINER_MODE` set to `nginx` the `PHP_FPM_LISTEN_PORT` environment variable is ignored and the `PHP_FPM_HOST` variable defined below changes. You can add multiple PHP-FPM hosts to the backend in this syntax 189 | : seperated by commas e.g `php-fpm-container1:9000,php-fpm-container2:9000` 190 | 191 | *You can also pass arguments to each server as defined in the [Nginx Upstream Documentation](https://nginx.org/en/docs/http/ngx_http_upstream_module.html)* 192 | 193 | | Parameter | Description | Default | 194 | | ------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------- | 195 | | `PHP_APC_SHM_SIZE` | APC Cache Memory size - `0` to disable | `128M` | 196 | | `PHP_APC_TTL` | APC Time to live in seconds | `7200` | 197 | | `PHP_FPM_HOST` | PHP-FPM Host, dependenent on PHP_FPM_LISTEN_TYPE, add multiple with commas | `127.0.0.1:9000` or `/var/run/php-fpm.sock` | 198 | | `PHP_FPM_LISTEN_TYPE` | PHP-FPM listen type `UNIX` sockets or `TCP` sockets | `unix` | 199 | | `PHP_FPM_LISTEN_TCP_IP` | PHP-FPM Listening IP if `PHP_LISTEN_TYPE=TCP` | `0.0.0.0` | 200 | | `PHP_FPM_LISTEN_TCP_IP_ALLOWED` | PHP-FPM allow only these hosts if `PHP_LISTEN_TYPE=TCP` | `127.0.0.1` | 201 | | `PHP_FPM_LISTEN_TCP_PORT` | PHP-FPM Listening Port - Ignored with above container options | `9000` | 202 | | `PHP_FPM_LISTEN_UNIX_SOCKET` | PHP-FPM Listen Socket if `PHP_LISTEN_TYPE=UNIX` | `/var/run/php-fpm.sock` | 203 | | `PHP_FPM_LISTEN_UNIX_SOCKET_USER` | PHP-FPM Listen Socket user `PHP_LISTEN_TYPE=UNIX` | `${NGINX_USER}` or `${UNIT_USER}` | 204 | | `PHP_FPM_LISTEN_UNIX_SOCKET_GROUP` | PHP-FPM Listen Socket group `PHP_LISTEN_TYPE=UNIX` | `${NGINX_GROUP}` or `${UNIT_GROUP}` | 205 | | `PHP_FPM_MAX_CHILDREN` | Maximum Children | `75` | 206 | | `PHP_FPM_MAX_REQUESTS` | How many requests before spawning new server | `500` | 207 | | `PHP_FPM_MAX_SPARE_SERVERS` | Maximum Spare Servers available | `3` | 208 | | `PHP_FPM_MIN_SPARE_SERVERS` | Minium Spare Servers avaialble | `1` | 209 | | `PHP_FPM_OUTPUT_BUFFER_SIZE` | Output buffer size in bytes | `0` | 210 | | `PHP_FPM_POST_INIT_COMMAND` | If you wish to execute a command before php-fpm executes, enter it here and seperate multiples by comma. | | 211 | | `PHP_FPM_POST_INIT_SCRIPT` | If you wish to execute a script before php-fpm executes, enter it here and seperate multiples by comma. | | 212 | | `PHP_FPM_PROCESS_MANAGER` | How to handle processes `static`, `ondemand`, `dynamic` | `dynamic` | 213 | | `PHP_FPM_START_SERVERS` | How many FPM servers to start initially | `2` | 214 | | `PHP_FPM_USER` | User to run PHP-FPM master process as | `${NGINX_USER}` or `${UNIT_USER}` | 215 | | `PHP_HIDE_X_POWERED_BY` | Hide X-Powered by response | `TRUE` | 216 | | `PHP_LOG_ACCESS_FILE` | PHP Access Logfile Name | `access.log` | 217 | | `PHP_LOG_ERROR_FILE` | Logfile name | `error.log` | 218 | | `PHP_LOG_LEVEL` | PHP Log Level `alert` `error` `warning` `notice` `debug` | `notice` | 219 | | `PHP_LOG_ACCESS_FORMAT` | Log format - `default` or `json` | `default` | 220 | | `PHP_LOG_LIMIT` | Characters to log | `2048` | 221 | | `PHP_LOG_LOCATION` | Log Location for PHP Logs | `/www/logs/php-fpm` | 222 | | `PHP_MEMORY_LIMIT` | How much memory should PHP use | `128M` | 223 | | `PHP_OPCACHE_INTERNED_STRINGS_BUFFER` | OPCache interned strings buffer | `8` | 224 | | `PHP_OPCACHE_JIT_BUFFER_SIZE` | JIT Buffer Size `0` to disable | `50M` | 225 | | `PHP_OPCACHE_JIT_MODE` | JIT [CRTO](https://wiki.php.net/rfc/jit) Mode - > PHP 8.x | `1255` | 226 | | `PHP_OPCACHE_MAX_ACCELERATED_FILES` | OPCache Max accelerated files | `10000` | 227 | | `PHP_OPCACHE_MEM_SIZE` | OPCache Memory Size - Set `0` to disable or via other env vars | `128` | 228 | | `PHP_OPCACHE_REVALIDATE_FREQ` | OPCache revalidate frequency in seconds | `2` | 229 | | `PHP_OPCACHE_MAX_WASTED_PERCENTAGE` | Max wasted percentage cache | `5` | 230 | | `PHP_OPCACHE_VALIDATE_TIMESTAMPS` | Validate timestamps `1` or `0` | `1` | 231 | | `PHP_OPCACHE_SAVE_COMMENTS` | Opcache Save Comments `0` or `1` | `1` | 232 | | `PHP_OPCACHE_MAX_FILE_SIZE` | Opcache maximum file size | `0` | 233 | | `PHP_OPCACHE_OPTIMIZATION_LEVEL` | Opcache optimization level | `0x7FFFBFF` | 234 | | `PHP_POST_MAX_SIZE` | Maximum Input Size for POST | `2G` | 235 | | `PHP_TIMEOUT` | Maximum Script execution Time | `180` | 236 | | `PHP_UPLOAD_MAX_SIZE` | Maximum Input Size for Uploads | `2G` | 237 | | `PHP_WEBROOT` | Used with `CONTAINER_MODE=php-fpm` | `/www/html` | 238 | 239 | #### Enabling / Disabling Specific Extensions 240 | 241 | Enable extensions by using the PHP extension name ie redis as `PHP_ENABLE_REDIS=TRUE`. Core extensions are enabled by default are: 242 | 243 | | Parameter | Default | 244 | | ---------------------- | ------- | 245 | | `PHP_ENABLE_APCU` | `TRUE` | 246 | | `PHP_ENABLE_BCMATH` | `TRUE` | 247 | | `PHP_ENABLE_BZ2` | `TRUE` | 248 | | `PHP_ENABLE_CTYPE` | `TRUE` | 249 | | `PHP_ENABLE_CURL` | `TRUE` | 250 | | `PHP_ENABLE_DOM` | `TRUE` | 251 | | `PHP_ENABLE_EXIF` | `TRUE` | 252 | | `PHP_ENABLE_FILEINFO` | `TRUE` | 253 | | `PHP_ENABLE_GD` | `TRUE` | 254 | | `PHP_ENABLE_ICONV` | `TRUE` | 255 | | `PHP_ENABLE_IMAP` | `TRUE` | 256 | | `PHP_ENABLE_INTL` | `TRUE` | 257 | | `PHP_ENABLE_JSON` | `TRUE` | 258 | | `PHP_ENABLE_MBSTRING` | `TRUE` | 259 | | `PHP_ENABLE_MYSQLI` | `TRUE` | 260 | | `PHP_ENABLE_MYSQLND` | `TRUE` | 261 | | `PHP_ENABLE_OPCACHE` | `TRUE` | 262 | | `PHP_ENABLE_OPENSSL` | `TRUE` | 263 | | `PHP_ENABLE_PDO` | `TRUE` | 264 | | `PHP_ENABLE_PDO_MYSQL` | `TRUE` | 265 | | `PHP_ENABLE_PGSQL` | `TRUE` | 266 | | `PHP_ENABLE_PHAR` | `TRUE` | 267 | | `PHP_ENABLE_SESSION` | `TRUE` | 268 | | `PHP_ENABLE_SIMPLEXML` | `TRUE` | 269 | | `PHP_ENABLE_TOKENIZER` | `TRUE` | 270 | | `PHP_ENABLE_XML` | `TRUE` | 271 | | `PHP_ENABLE_XMLREADER` | `TRUE` | 272 | | `PHP_ENABLE_XMLWRITER` | `TRUE` | 273 | 274 | To enable all extensions in image use `PHP_KITCHENSINK=TRUE`. Head inside the image and see what extensions are available by typing `php-ext list all` 275 | 276 | #### Debug Options 277 | To enable XDebug set `PHP_ENABLE_XDEBUG=TRUE`. Visit the [PHP XDebug Documentation](https://xdebug.org/docs/all_settings#remote_connect_back) to understand what these options mean. 278 | If you debug a PHP project in PHPStorm, you need to set server name using `PHP_IDE_CONFIG` to the same value as set in PHPStorm. Usual value is localhost, i.e. `PHP_IDE_CONFIG="serverName=localhost"`. 279 | 280 | For Xdebug 2 (php <= 7.1) you should set: 281 | | Parameter | Description | Default | 282 | | ------------------------------------ | ------------------------------------------ | ------------------- | 283 | | `PHP_XDEBUG_PROFILER_DIR` | Where to store Profiler Logs | `/www/logs/xdebug/` | 284 | | `PHP_XDEBUG_PROFILER_ENABLE` | Enable Profiler | `0` | 285 | | `PHP_XDEBUG_PROFILER_ENABLE_TRIGGER` | Enable Profiler Trigger | `0` | 286 | | `PHP_XDEBUG_REMOTE_AUTOSTART` | Enable Autostarting as opposed to GET/POST | `1` | 287 | | `PHP_XDEBUG_REMOTE_CONNECT_BACK` | Enbable Connection Back | `0` | 288 | | `PHP_XDEBUG_REMOTE_ENABLE` | Enable Remote Debugging | `1` | 289 | | `PHP_XDEBUG_REMOTE_HANDLER` | XDebug Remote Handler | `dbgp` | 290 | | `PHP_XDEBUG_REMOTE_HOST` | Set this to your IP Address | `127.0.0.1` | 291 | | `PHP_XDEBUG_REMOTE_PORT` | XDebug Remote Port | `9090` | 292 | 293 | * * * 294 | 295 | For Xdebug 3 (php >= 7.2) you should set: 296 | | Parameter | Description | Default | 297 | | --------------------------------- | -------------------------------------------------------------------- | ------------------- | 298 | | `PHP_XDEBUG_OUTPUT_DIR` | Where to store Logs | `/www/logs/xdebug/` | 299 | | `PHP_XDEBUG_MODE` | This setting controls which Xdebug features are enabled. | `develop` | 300 | | `PHP_XDEBUG_START_WITH_REQUEST` | Enable Autostarting as opposed to GET/POST | `default` | 301 | | `PHP_XDEBUG_DISCOVER_CLIENT_HOST` | Xdebug will try to connect to the client that made the HTTP request. | `1` | 302 | | `PHP_XDEBUG_CLIENT_HOST` | Set this to your IP Address | `127.0.0.1` | 303 | | `PHP_XDEBUG_CLIENT_PORT` | XDebug Remote Port | `9003` | 304 | 305 | * * * 306 | 307 | ### Networking 308 | 309 | The following ports are exposed. 310 | 311 | | Port | Description | 312 | | ------ | ----------- | 313 | | `9000` | PHP-FPM | 314 | 315 | 316 | ## Maintenance 317 | Inside the image are tools to perform modification on how the image runs. 318 | 319 | ### Shell Access 320 | For debugging and maintenance purposes you may want access the containers shell. 321 | 322 | ```bash 323 | docker exec -it (whatever your container name is e.g. nginx-php-fpm) bash 324 | ``` 325 | ### PHP Extensions 326 | If you want to enable or disable or list what PHP extensions are available, type `php-ext help` 327 | 328 | ### Maintenance Mode 329 | If you wish to turn the web server into maintenance mode showing a single page screen outlining that the service is being worked on, you can also enter into the container and type `maintenance ARG`, where ARG is either `ON`,`OFF`, or `SLEEP (seconds)` which will temporarily place the site in maintenance mode and then restore it back to normal after time has passed. 330 | ## Contributions 331 | Welcomed. Please fork the repository and submit a [pull request](../../pulls) for any bug fixes, features or additions you propose to be included in the image. If it does not impact my intended usage case, it will be merged into the tree, tagged as a release and credit to the contributor in the [CHANGELOG](CHANGELOG). 332 | 333 | ## Support 334 | 335 | These images were built to serve a specific need in a production environment and gradually have had more functionality added based on requests from the community. 336 | ### Usage 337 | - The [Discussions board](../../discussions) is a great place for working with the community on tips and tricks of using this image. 338 | - [Sponsor me](https://tiredofit.ca/sponsor) for personalized support 339 | ### Bugfixes 340 | - Please, submit a [Bug Report](issues/new) if something isn't working as expected. I'll do my best to issue a fix in short order. 341 | 342 | ### Feature Requests 343 | - Feel free to submit a feature request, however there is no guarantee that it will be added, or at what timeline. 344 | - [Sponsor me](https://tiredofit.ca/sponsor) regarding development of features. 345 | 346 | ### Updates 347 | - Best effort to track upstream changes, More priority if I am actively using the image in a production environment. 348 | - [Sponsor me](https://tiredofit.ca/sponsor) for up to date releases. 349 | 350 | ## License 351 | MIT. See [LICENSE](LICENSE) for more details. 352 | 353 | ## References 354 | 355 | * http://www.php.org 356 | * https://xdebug.org 357 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | !docker-compose.yml 2 | -------------------------------------------------------------------------------- /examples/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tiredofit/docker-nginx-php-fpm/82404da39a6450219bad2cbb0e5e5ec25444ff62/examples/.gitkeep -------------------------------------------------------------------------------- /examples/compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | nginx-php-fpm-app: 3 | image: tiredofit/nginx-php-fpm/8.3-alpine 4 | container_name: nginx-php-fpm-app 5 | labels: 6 | - traefik.enable=true 7 | - traefik.http.routers.nginx-php-fpm-app.rule=Host(`nginx.example.com`) 8 | - traefik.http.services.nginx-php-fpm-app.loadbalancer.server.port=80 9 | volumes: 10 | - ./data/:/www/html 11 | - ./logs/:/www/logs 12 | environment: 13 | - TIMEZONE=America/Vancouver 14 | - CONTAINER_NAME=nginx-php-fpm-app-app 15 | networks: 16 | - services 17 | - proxy 18 | restart: always 19 | 20 | networks: 21 | proxy: 22 | external: true 23 | services: 24 | external: true 25 | 26 | -------------------------------------------------------------------------------- /install/assets/defaults/20-php-fpm: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | 3 | ### Set Defaults 4 | ENABLE_PHP_FPM=${ENABLE_PHP_FPM:-"TRUE"} 5 | PHP_APC_SHM_SIZE=${PHP_APC_SHM_SIZE:-"128M"} 6 | PHP_APC_TTL=${PHP_APC_TTL:-"7200"} 7 | PHP_FPM_CONTAINER_MODE=${PHP_FPM_CONTAINER_MODE:-"nginx-php-fpm"} 8 | PHP_DISPLAY_ERRORS=${PHP_DISPLAY_ERRORS:-"TRUE"} 9 | PHP_ENABLE_CREATE_SAMPLE_PHP=${PHP_ENABLE_CREATE_SAMPLE_PHP:-"TRUE"} 10 | PHP_HIDE_X_POWERED_BY=${PHP_HIDE_X_POWERED_BY:-"TRUE"} 11 | PHP_KITCHENSINK=${PHP_KITCHENSINK:-"FALSE"} 12 | PHP_FPM_LISTEN_IP=${PHP_FPM_LISTEN_IP:-"0.0.0.0"} 13 | PHP_FPM_LISTEN_TYPE=${PHP_FPM_LISTEN_TYPE:-"unix"} 14 | PHP_FPM_LISTEN_PORT=${PHP_FPM_LISTEN_PORT:-"9000"} 15 | PHP_FPM_LISTEN_TCP_IP=${PHP_FPM_LISTEN_TCP_IP:-"${PHP_FPM_LISTEN_IP}"} 16 | PHP_FPM_LISTEN_TCP_IP_ALLOWED=${PHP_FPM_LISTEN_TCP_IP_ALLOWED:-"127.0.0.1"} 17 | PHP_FPM_LISTEN_TCP_PORT=${PHP_FPM_LISTEN_TCP_PORT:-"${PHP_FPM_LISTEN_PORT}"} 18 | PHP_FPM_LISTEN_UNIX_SOCKET=${PHP_FPM_LISTEN_UNIX_SOCKET:-"/var/lib/php-fpm/run/php-fpm.sock"} 19 | PHP_FPM_MAX_CHILDREN=${PHP_FPM_MAX_CHILDREN:-"75"} 20 | PHP_FPM_MAX_REQUESTS=${PHP_FPM_MAX_REQUESTS:-"500"} 21 | PHP_FPM_MAX_SPARE_SERVERS=${PHP_FPM_MAX_SPARE_SERVERS:-"3"} 22 | PHP_FPM_MIN_SPARE_SERVERS=${PHP_FPM_MIN_SPARE_SERVERS:-"1"} 23 | PHP_FPM_OUTPUT_BUFFER_SIZE=${PHP_FPM_OUTPUT_BUFFER_SIZE:-"0"} 24 | PHP_FPM_PROCESS_MANAGER=${PHP_FPM_PROCESS_MANAGER:-"dynamic"} 25 | PHP_FPM_START_SERVERS=${PHP_FPM_START_SERVERS:-"2"} 26 | PHP_LOG_ACCESS_FILE=${PHP_LOG_ACCESS_FILE:-"access.log"} 27 | PHP_LOG_ACCESS_FORMAT=${PHP_LOG_ACCESS_FORMAT:-"default"} 28 | PHP_LOG_ERROR_FILE=${PHP_LOG_ERROR_FILE:-"error.log"} 29 | PHP_LOG_LEVEL=${PHP_LOG_LEVEL:-"notice"} 30 | PHP_LOG_LIMIT=${PHP_LOG_LIMIT:-"3072"} 31 | PHP_LOG_LOCATION=${PHP_LOG_LOCATION:-"/www/logs/php-fpm"} 32 | PHP_MEMORY_LIMIT=${PHP_MEMORY_LIMIT:-"128M"} 33 | PHP_OPCACHE_INTERNED_STRINGS_BUFFER=${PHP_OPCACHE_INTERNED_STRINGS_BUFFER:-"8"} 34 | PHP_OPCACHE_JIT_BUFFER_SIZE=${PHP_OPCACHE_JIT_BUFFER_SIZE:-"50M"} 35 | PHP_OPCACHE_JIT_MODE=${PHP_OPCACHE_JIT_MODE:-"1255"} 36 | PHP_OPCACHE_MAX_ACCELERATED_FILES=${PHP_OPCACHE_MAX_ACCELERATED_FILES:-"10000"} 37 | PHP_OPCACHE_MAX_FILE_SIZE=${PHP_OPCACHE_MAX_FILE_SIZE:-"0"} 38 | PHP_OPCACHE_MAX_WASTED_PERCENTAGE=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE:-"5"} 39 | PHP_OPCACHE_MEM_SIZE=${PHP_OPCACHE_MEM_SIZE:-"128"} 40 | PHP_OPCACHE_OPTIMIZATION_LEVEL=${PHP_OPCACHE_OPTIMIZATION_LEVEL:-"0x7FFFBFF"} 41 | PHP_OPCACHE_REVALIDATE_FREQ=${PHP_OPCACHE_REVALIDATE_FREQ:-"2"} 42 | PHP_OPCACHE_SAVE_COMMENTS=${PHP_OPCACHE_SAVE_COMMENTS:-"1"} 43 | PHP_OPCACHE_VALIDATE_TIMESTAMPS=${PHP_OPCACHE_VALIDATE_TIMESTAMPS:-"1"} 44 | PHP_POST_MAX_SIZE=${PHP_POST_MAX_SIZE:-"2G"} 45 | PHP_TIMEOUT=${PHP_TIMEOUT:-"180"} 46 | PHP_UPLOAD_MAX_SIZE=${PHP_UPLOAD_MAX_SIZE:-"2G"} 47 | PHP_VERSION=${PHP_VERSION:-$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}')} 48 | PHP_WEBROOT=${PHP_WEBROOT:-$NGINX_WEBROOT} 49 | 50 | #Xdebug 2 51 | PHP_XDEBUG_PROFILER_DIR=${PHP_XDEBUG_PROFILER_DIR:-"${PHP_LOG_LOCATION}/xdebug/"} 52 | PHP_XDEBUG_PROFILER_ENABLE=${PHP_XDEBUG_PROFILER_ENABLE:-"0"} 53 | PHP_XDEBUG_PROFILER_ENABLE_TRIGGER=${PHP_XDEBUG_PROFILER_ENABLE_TRIGGER:-"0"} 54 | PHP_XDEBUG_REMOTE_AUTOSTART=${PHP_XDEBUG_REMOTE_AUTOSTART:-"1"} 55 | PHP_XDEBUG_REMOTE_CONNECT_BACK=${PHP_XDEBUG_REMOTE_CONNECT_BACK:-"0"} 56 | PHP_XDEBUG_REMOTE_ENABLE=${PHP_XDEBUG_REMOTE_ENABLE:-"1"} 57 | PHP_XDEBUG_REMOTE_HANDLER=${PHP_XDEBUG_REMOTE_HANDLER:-"dbgp"} 58 | PHP_XDEBUG_REMOTE_HOST=${PHP_XDEBUG_REMOTE_HOST:-"127.0.0.1"} 59 | PHP_XDEBUG_REMOTE_PORT=${PHP_XDEBUG_REMOTE_PORT:-"9090"} 60 | 61 | #Xdebug 3 62 | PHP_XDEBUG_OUTPUT_DIR=${PHP_XDEBUG_OUTPUT_DIR:-"${PHP_LOG_LOCATION}/xdebug/"} 63 | PHP_XDEBUG_MODE=${PHP_XDEBUG_MODE:-"develop"} 64 | PHP_XDEBUG_START_WITH_REQUEST=${PHP_XDEBUG_START_WITH_REQUEST:-"default"} 65 | PHP_XDEBUG_DISCOVER_CLIENT_HOST=${PHP_XDEBUG_DISCOVER_CLIENT_HOST:-"default"} 66 | PHP_XDEBUG_CLIENT_HOST=${PHP_XDEBUG_CLIENT_HOST:-"127.0.0.1"} 67 | PHP_XDEBUG_CLIENT_PORT=${PHP_XDEBUG_CLIENT_PORT:-"9003"} 68 | 69 | if [ -f "/usr/sbin/unitd" ] ; then 70 | PHP_FPM_LISTEN_UNIX_GROUP=${PHP_FPM_LISTEN_UNIX_GROUP:-"${UNIT_GROUP}"} 71 | PHP_FPM_LISTEN_UNIX_USER=${PHP_FPM_LISTEN_UNIX_USER:-"${UNIT_USER}"} 72 | PHP_FPM_USER=${PHP_FPM_USER:-"${UNIT_USER}"} 73 | PHP_FPM_GROUP=${PHP_FPM_GROUP:-"${UNIT_GROUP}"} 74 | fi 75 | 76 | if [ -f "/usr/sbin/nginx" ] ; then 77 | PHP_FPM_LISTEN_UNIX_GROUP=${PHP_FPM_LISTEN_UNIX_GROUP:-"${NGINX_GROUP}"} 78 | PHP_FPM_LISTEN_UNIX_USER=${PHP_FPM_LISTEN_UNIX_USER:-"${NGINX_USER}"} 79 | PHP_FPM_USER=${PHP_FPM_USER:-"${NGINX_USER}"} 80 | PHP_FPM_GROUP=${PHP_FPM_GROUP:-"${NGINX_GROUP}"} 81 | fi 82 | 83 | if [ -z "${PHP_FPM_HOST}" ]; then 84 | case "${PHP_FPM_LISTEN_TYPE,,}" in 85 | tcp ) 86 | PHP_FPM_HOST=127.0.0.1:${PHP_FPM_LISTEN_TCP_PORT} 87 | ;; 88 | unix ) 89 | PHP_FPM_HOST=${PHP_FPM_LISTEN_UNIX_SOCKET} 90 | ;; 91 | esac 92 | fi 93 | 94 | if [ "${PHP_BASE:0:1}" != "8" ] ; then 95 | PHP_ENABLE_JSON=TRUE 96 | fi 97 | 98 | if [ "${PHP_ENABLE_REDIS,,}" = "true" ] ; then 99 | PHP_ENABLE_IGBINARY=TRUE 100 | PHP_ENABLE_MSGPACK=TRUE 101 | fi 102 | 103 | if [ "${PHP_ENABLE_MEMCACHED,,}" = "true" ] ; then 104 | PHP_ENABLE_IGBINARY=TRUE 105 | PHP_ENABLE_MSGPACK=TRUE 106 | fi 107 | 108 | -------------------------------------------------------------------------------- /install/assets/functions/20-php-fpm: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | 3 | phpfpm_bootstrap() { 4 | os=$(cat /etc/os-release |grep ^ID= | cut -d = -f2) 5 | case ${os} in 6 | "alpine" ) 7 | case "${PHP_BASE}" in 8 | 8.1 ) 9 | php_prefix="/etc/php81/" 10 | ;; 11 | 8.2 ) 12 | php_prefix="/etc/php82/" 13 | ;; 14 | 8.3 ) 15 | php_prefix="/etc/php83/" 16 | ;; 17 | * ) 18 | php_prefix="/etc/php$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1)/" 19 | ;; 20 | esac 21 | ;; 22 | "debian" ) 23 | php_prefix="/etc/php/$(php -v 2>/dev/null | grep "^PHP " | head -n 1 | awk '{print $2}' | cut -c 1-3)/" 24 | ;; 25 | esac 26 | 27 | case "${PHP_BASE}" in 28 | "5.6" | "7.0" | "7.1" | "7.2" ) 29 | sed -i "/log_limit =/d" /assets/php-fpm/fpm/php-fpm.conf 30 | ;; 31 | esac 32 | } 33 | 34 | phpfpm_configure_authentication() { 35 | print_notice "Adding LLNG Authentication parameters to nginx configuration" 36 | header_num=$(printenv | sort | grep -c '^NGINX_AUTHENTICATION_LLNG_ATTRIBUTE.*') 37 | for ((i = 1; i <= header_num; i++)); do 38 | headers=NGINX_AUTHENTICATION_LLNG_ATTRIBUTE${i} 39 | IFS=',' read -r -a array <<<"${!headers}" 40 | 41 | print_notice "Updating Nginx to support receiving attribute from LLNG: '${array[0]}'" 42 | 43 | echo "fastcgi_param ${array[0]} \$${array[1]};" >>/etc/nginx/snippets/authentication/llng_params 44 | echo "auth_request_set \$${array[1]} \$${array[2]};" >>/etc/nginx/snippets/authentication/llng_auth_request 45 | done 46 | cp -R /etc/nginx/snippets/php-fpm.conf /etc/nginx/snippets/monitoring-php-fpm.conf 47 | sed -i "s|include /etc/nginx/snippets/php-fpm.conf;|include /etc/nginx/snippets/monitoring-php-fpm.conf;|g" /etc/nginx/snippets/monitoring.conf 48 | cat <> /etc/nginx/snippets/php-fpm.conf 49 | 50 | ### LLNG Authentication handler 51 | include /etc/nginx/snippets/authentication/llng_auth_request; 52 | include /etc/nginx/snippets/authentication/llng_params; 53 | EOF 54 | 55 | if [ "${NGINX_SITE_ENABLED}" = "default" ] ; then 56 | 57 | sed -i '/server {/a\ \ \ \ \ include /etc/nginx/snippets/authentication/llng_location_block;' /etc/nginx/sites.available/default.conf 58 | sed -i '/server {/a\ \ \ \ \ ### LLNG Authentication handler' /etc/nginx/sites.available/default.conf 59 | 60 | sed -i \ 61 | "/location \/ {/a\ 62 | \ ### LLNG Authentication handler \n\ 63 | include /etc/nginx/snippets/authentication/llng_auth_request;" \ 64 | /etc/nginx/sites.available/default.conf 65 | fi 66 | } 67 | 68 | 69 | phpfpm_configure_extensions() { 70 | if var_true "${PHP_ENABLE_XDEBUG}" ; then 71 | if [ "${PHP_BASE:0:1}" = "5" ] || [ "${PHP_BASE:0:3}" = "7.0" ] || [ "${PHP_BASE:0:3}" = "7.1" ] ; then 72 | cat <> "${php_prefix}"mods-available/xdebug.ini 73 | zend_extension=xdebug.so 74 | xdebug.default_enable = 1 75 | xdebug.profiler_enable= ${PHP_XDEBUG_PROFILER_ENABLE} 76 | xdebug.profiler_enable_trigger= ${PHP_XDEBUG_PROFILER_ENABLE_TRIGGER} 77 | xdebug.profiler_output_dir='${PHP_XDEBUG_PROFILER_DIR}' 78 | xdebug.remote_autostart = ${PHP_XDEBUG_REMOTE_AUTOSTART} 79 | xdebug.remote_connect_back = ${PHP_XDEBUG_REMOTE_CONNECT_BACK} 80 | xdebug.remote_enable = ${PHP_XDEBUG_REMOTE_ENABLE} 81 | xdebug.remote_handler = ${PHP_XDEBUG_REMOTE_HANDLER} 82 | xdebug.remote_host = ${PHP_XDEBUG_REMOTE_HOST} 83 | xdebug.remote_port = ${PHP_XDEBUG_REMOTE_PORT} 84 | EOF 85 | else 86 | cat <> "${php_prefix}"mods-available/xdebug.ini 87 | zend_extension=xdebug.so 88 | xdebug.default_enable = 1 89 | xdebug.output_dir = ${PHP_XDEBUG_OUTPUT_DIR} 90 | xdebug.mode = ${PHP_XDEBUG_MODE} 91 | xdebug.start_with_request = ${PHP_XDEBUG_START_WITH_REQUEST} 92 | xdebug.discover_client_host = ${PHP_XDEBUG_DISCOVER_CLIENT_HOST} 93 | xdebug.client_host = ${PHP_XDEBUG_CLIENT_HOST} 94 | xdebug.client_port = ${PHP_XDEBUG_CLIENT_PORT} 95 | EOF 96 | fi 97 | PHP_LOG_LEVEL=debug 98 | print_notice "DEBUGGING MODE ACTIVATED: Please use your IDE to connect to: ${PHP_XDEBUG_REMOTE_HOST}:${PHP_XDEBUG_REMOTE_PORT}" 99 | if [ "${PHP_XDEBUG_PROFILER_ENABLE}" = "1" ] || [ "${PHP_XDEBUG_MODE}" = "trace" ]; then 100 | print_notice "PROFILING MODE ACTIVATED: Please find the profiler logs at: ${PHP_XDEBUG_PROFILER_DIR}" 101 | mkdir -p "$PHP_XDEBUG_PROFILER_DIR" 102 | chown -R "${PHP_FPM_USER}":"${PHP_FPM_GROUP}" "${PHP_XDEBUG_PROFILER_DIR}" 103 | fi 104 | fi 105 | 106 | case ${os} in 107 | "alpine" ) 108 | if var_true "${ENABLE_SMTP}" || var_true "${CONTAINER_ENABLE_MESSAGING}" ; then 109 | echo 'sendmail_path="/usr/bin/msmtp -C /etc/msmtprc -t "' > "${php_prefix}"/conf.d/99-smtp.ini 110 | fi 111 | echo "date.timezone=$(cat /etc/timezone)" > "${php_prefix}"/conf.d/99-timezone.ini 112 | ;; 113 | "debian" ) 114 | if var_true "${ENABLE_SMTP}" || var_true "${CONTAINER_ENABLE_MESSAGING}" ; then 115 | echo 'sendmail_path="/usr/bin/msmtp -C /etc/msmtprc -t "' > "${php_prefix}"cli/conf.d/99-smtp.ini 116 | echo 'sendmail_path="/usr/bin/msmtp -C /etc/msmtprc -t "' > "${php_prefix}"fpm/conf.d/99-smtp.ini 117 | fi 118 | echo "date.timezone=$(cat /etc/timezone)" > "${php_prefix}"fpm/conf.d/99-timezone.ini 119 | ;; 120 | esac 121 | 122 | if var_true "${CONTAINER_ENABLE_MESSAGING}" ; then 123 | chown "${PHP_FPM_USER}":"${PHP_FPM_GROUP}" /etc/msmtprc 124 | chmod 0600 /etc/msmtprc 125 | fi 126 | 127 | if [ "${PHP_APC_SHM_SIZE}" = "0" ]; then 128 | sed -i -e "s/apc.enabled=1/apc.enabled=0/g" /assets/php-fpm/mods-available/acpu.ini 129 | fi 130 | 131 | if [ "${PHP_OPCACHE_MEM_SIZE}" = "0" ] || var_false "${PHP_ENABLE_OPCACHE}" ; then 132 | sed -i \ 133 | -e "s/opcache.enable=1/opcache.enable=0/g" \ 134 | -e "s/opcache.enable_cli=1/opcache.enable_cli=0/g" \ 135 | /assets/php-fpm/mods-available/opcache.ini 136 | else 137 | if var_true "${CONTAINER_ENABLE_MONITORING}" && [ "${CONTAINER_MONITORING_BACKEND,,}" = "zabbix" ]; then 138 | source /assets/defaults/03-monitoring 139 | cat < "${ZABBIX_CONFIG_PATH}"/"${ZABBIX_CONFIG_FILE}.d"/tiredofit-php_opcache.conf 140 | # Zabbix PHP Opcache Configuration - Automatically Generated 141 | # Find Companion Zabbix Server Templates at https://github.com/tiredofit/docker-nginx-php-fpm 142 | # Autoregister=opcache 143 | 144 | UserParameter=php.opcache.get_status,sudo -Eu zabbix php /etc/zabbix/zabbix_agentd.conf.d/scripts/php/opcache-status.php 145 | UserParameter=php.opcache.get_settings,sudo -Eu zabbix php /etc/zabbix/zabbix_agentd.conf.d/scripts/php/opcache-settings.php 146 | EOF 147 | fi 148 | fi 149 | } 150 | 151 | phpfpm_configure_logging() { 152 | mkdir -p "${PHP_LOG_LOCATION}" 153 | touch "${PHP_LOG_LOCATION}"/"${PHP_LOG_ACCESS_FILE}" 154 | touch "${PHP_LOG_LOCATION}"/"${PHP_LOG_ERROR_FILE}" 155 | chown -R "${PHP_FPM_USER}":"${PHP_FPM_GROUP}" "${PHP_LOG_LOCATION}" 156 | create_logrotate php-fpm-access "${PHP_LOG_LOCATION}"/"${PHP_LOG_ACCESS_FILE}" php-fpm "${NGINX_USER}" "${PHP_FPM_GROUP}" 157 | create_logrotate php-fpm-error "${PHP_LOG_LOCATION}"/"${PHP_LOG_ERROR_FILE}" php-fpm-error "${NGINX_USER}" "${PHP_FPM_GROUP}" 158 | sed -i "/access.format=/d" /assets/php-fpm/fpm/php-fpm.conf 159 | case "${PHP_LOG_ACCESS_FORMAT,,}" in 160 | "default" | "standard" ) 161 | cat /assets/php-fpm/fpm/default.logformat >> /assets/php-fpm/fpm/php-fpm.conf 162 | ;; 163 | "json" ) 164 | cat /assets/php-fpm/fpm/json.logformat >> /assets/php-fpm/fpm/php-fpm.conf 165 | ;; 166 | esac 167 | 168 | update_template /assets/php-fpm/fpm/php-fpm.conf PHP_LOG_LEVEL 169 | } 170 | 171 | phpfpm_configure_nginx() { 172 | ### Create Upstream PHP Hosts 173 | if var_true "${NGINX_ENABLE_UPSTREAM_KEEPALIVE}" ; then 174 | upstream_keepalive="keepalive ${NGINX_UPSTREAM_KEEPALIVE};" 175 | fi 176 | php_fpm_hosts=$(echo "${PHP_FPM_HOST}" | tr "," "\n") 177 | echo "upstream php-fpm-upstream {" >> /etc/nginx/snippets/php-fpm-upstream.conf 178 | echo " ${upstream_keepalive}" >> /etc/nginx/snippets/php-fpm-upstream.conf 179 | for php_fpm_host in $php_fpm_hosts; do 180 | if [[ ${php_fpm_host} != *":"* ]];then 181 | php_fpm_host_socket_prefix="unix://" 182 | fi 183 | echo " server ${php_fpm_host_socket_prefix}${php_fpm_host} ${PHP_FPM_UPSTREAM_OPTIONS};" >> /etc/nginx/snippets/php-fpm-upstream.conf 184 | done 185 | echo "}" >> /etc/nginx/snippets/php-fpm-upstream.conf 186 | 187 | sed -i \ 188 | -e "/# Do not delete - Upstream Configuration/a\ \ \ \ include \/etc\/nginx\/snippets\/php-fpm-upstream.conf;" \ 189 | -e "/# Do not delete - Upstream Configuration/a\ \ \ \ ### PHP-FPM Multiple Handlers configuration" \ 190 | /etc/nginx/nginx.conf 191 | 192 | if var_true "${PHP_HIDE_X_POWERED_BY}" ; then 193 | sed -i "/fastcgi_buffer_size/a \ fastcgi_hide_header X-Powered-By;" /etc/nginx/nginx.conf 194 | fi 195 | } 196 | 197 | phpfpm_configure_server() { 198 | create_socket_dir() { 199 | if [ ! -d "$(dirname "${PHP_FPM_LISTEN_UNIX_SOCKET}")" ]; then 200 | mkdir -p "$(dirname "${PHP_FPM_LISTEN_UNIX_SOCKET}")" 201 | chown -R "${PHP_FPM_LISTEN_UNIX_USER}":"${PHP_FPM_LISTEN_UNIX_GROUP}" "$(dirname "${PHP_FPM_LISTEN_UNIX_SOCKET}")" 202 | fi 203 | } 204 | 205 | if [ "${PHP_BASE:0:1}" = "5" ] ; then echo "suhosin.executor.include.whitelist = phar" >> /etc/php"${PHP_BASE:0:1}"/php.ini ; fi 206 | truefalse_onoff PHP_DISPLAY_ERRORS 207 | 208 | case "${PHP_FPM_LISTEN_TYPE,,}" in 209 | "tcp" ) 210 | sed -i \ 211 | -e "/listen = {{PHP_FPM_LISTEN_UNIX_SOCKET}}/d" \ 212 | -e "/listen.owner = {{PHP_FPM_LISTEN_UNIX_USER}}/d" \ 213 | -e "/listen.group = {{PHP_FPM_LISTEN_UNIX_GROUP}}/d" \ 214 | /assets/php-fpm/fpm/php-fpm.conf 215 | ;; 216 | "unix" ) 217 | create_socket_dir 218 | sed -i \ 219 | -e "/listen = {{PHP_FPM_LISTEN_TCP_IP}}:{{PHP_FPM_LISTEN_TCP_PORT}}/d" \ 220 | -e "/listen.allowed_clients = {{PHP_FPM_LISTEN_TCP_IP_ALLOWED}}/d" \ 221 | /assets/php-fpm/fpm/php-fpm.conf 222 | ;; 223 | esac 224 | 225 | update_template /assets/php-fpm/fpm/php-fpm.conf \ 226 | PHP_DISPLAY_ERRORS \ 227 | PHP_FPM_HOST \ 228 | PHP_FPM_LISTEN_TCP_IP \ 229 | PHP_FPM_LISTEN_TCP_IP_ALLOWED \ 230 | PHP_FPM_LISTEN_TCP_PORT \ 231 | PHP_FPM_LISTEN_UNIX_GROUP \ 232 | PHP_FPM_LISTEN_UNIX_SOCKET \ 233 | PHP_FPM_LISTEN_UNIX_USER \ 234 | PHP_FPM_MAX_CHILDREN \ 235 | PHP_FPM_MAX_REQUESTS \ 236 | PHP_FPM_MAX_SPARE_SERVERS \ 237 | PHP_FPM_MIN_SPARE_SERVERS \ 238 | PHP_FPM_OUTPUT_BUFFER_SIZE \ 239 | PHP_FPM_PROCESS_MANAGER \ 240 | PHP_FPM_START_SERVERS \ 241 | PHP_LOG_ACCESS_FILE \ 242 | PHP_LOG_ERROR_FILE \ 243 | PHP_LOG_LIMIT \ 244 | PHP_LOG_LOCATION \ 245 | PHP_MEMORY_LIMIT \ 246 | PHP_POST_MAX_SIZE \ 247 | PHP_TIMEOUT \ 248 | PHP_UPLOAD_MAX_SIZE 249 | 250 | update_template /etc/nginx/snippets/php-fpm.conf PHP_TIMEOUT 251 | 252 | sed -i \ 253 | -e "s#apc.shm_size=.*#apc.shm_size=${PHP_APC_SHM_SIZE}#g" \ 254 | -e "s#apc.ttl=.*#apc.ttl=${PHP_APC_TTL}#g" \ 255 | /assets/php-fpm//mods-available/apcu.ini 256 | 257 | sed -i \ 258 | -e "s#opcache.interned_strings_buffer=.*#opcache.interned_strings_buffer=${PHP_OPCACHE_INTERNED_STRINGS_BUFFER}#g" \ 259 | -e "s#opcache.max_accelerated_files=.*#opcache.max_accelerated_files=${PHP_OPCACHE_MAX_ACCELERATED_FILES}#g" \ 260 | -e "s#opcache.max_file_size=.*#opcache.max_file_size=${PHP_OPCACHE_MAX_FILE_SIZE}#g" \ 261 | -e "s#opcache.max_wasted_percentage=.*#opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}#g" \ 262 | -e "s#opcache.memory_consumption=.*#opcache.memory_consumption=${PHP_OPCACHE_MEM_SIZE}#g" \ 263 | -e "s#opcache.optimization_level=.*#opcache.optimization_level=${PHP_OPCACHE_OPTIMIZATION_LEVEL}#g" \ 264 | -e "s#opcache.revalidate_freq=.*#opcache.revalidate_freq=${PHP_OPCACHE_REVALIDATE_FREQ}#g" \ 265 | -e "s#opcache.revalidate_freq=.*#opcache.revalidate_freq=${PHP_OPCACHE_REVALIDATE_FREQ}#g" \ 266 | -e "s#opcache.save_comments=.*#opcache.save_comments=${PHP_OPCACHE_SAVE_COMMENTS}#g" \ 267 | -e "s#opcache.validate_timestamps=.*#opcache.validate_timestamps=${PHP_OPCACHE_VALIDATE_TIMESTAMPS}#g" \ 268 | /assets/php-fpm/mods-available/opcache.ini 269 | 270 | if [ "${PHP_BASE:0:1}" = "7" ] ; then 271 | sed -i "/opcache.jit/d" /assets/php-fpm/mods-available/opcache.ini 272 | else 273 | sed -i \ 274 | -e "s#opcache.jit_buffer_size=.*#opcache.jit_buffer_size=${PHP_OPCACHE_JIT_BUFFER_SIZE}#g" \ 275 | -e "s#opcache.jit=.*#opcache.jit=${PHP_OPCACHE_JIT_MODE}#g" \ 276 | /assets/php-fpm/mods-available/opcache.ini 277 | fi 278 | 279 | sed -i \ 280 | -e "s#memory_limit = .*#memory_limit = ${PHP_MEMORY_LIMIT}#g" \ 281 | -e "s#max_execution_time = .*#max_execution_time = ${PHP_TIMEOUT}#g" \ 282 | -e "s#max_input_time = .*#max_input_time = ${PHP_TIMEOUT}#g" \ 283 | -e "s#default_socket_timeout = .*#default_socket_timeout = ${PHP_TIMEOUT}#g" \ 284 | -e "s#post_max_size = .*#post_max_size = ${PHP_UPLOAD_MAX_SIZE}#g" \ 285 | -e "s#upload_max_filesize = .*#upload_max_filesize = ${PHP_UPLOAD_MAX_SIZE}#g" \ 286 | /assets/php-fpm/cli/php.ini 287 | 288 | if [ -n "${PHP_IDE_CONFIG}" ]; then 289 | if [[ "${PHP_IDE_CONFIG}" = \"* ]] || [[ "${PHP_IDE_CONFIG}" = \'* ]] ; then 290 | echo -e "env[PHP_IDE_CONFIG] = ${PHP_IDE_CONFIG}\n" >> /assets/php-fpm/fpm/php-fpm.conf 291 | else 292 | echo -e "env[PHP_IDE_CONFIG] = \"${PHP_IDE_CONFIG}\"\n" >> /assets/php-fpm/fpm/php-fpm.conf 293 | fi 294 | fi 295 | 296 | sed -i -e "s#date.timezone = .*#date.timezone = $(cat /etc/timezone)#g" /assets/php-fpm/cli/php.ini /assets/php-fpm/fpm/php.ini 297 | } 298 | 299 | phpfpm_create_default_page() { 300 | if var_true "${PHP_ENABLE_CREATE_SAMPLE_PHP}" ; then 301 | if [ ! -f "${NGINX_WEBROOT}"/index.php ] ; then 302 | print_notice "Creating sample index.php" 303 | mkdir -p "${NGINX_WEBROOT}" 304 | cat < "${NGINX_WEBROOT}"/index.php 305 | 306 | Default Page 307 |

Container is working

308 | Congratulations! Your ${IMAGE_NAME} ${os} PHP-FPM image is working. You are seeing this because you don't have an index.php file in your ${NGINX_WEBROOT} directory.
309 | 310 | 311 | EOF 312 | fi 313 | fi 314 | } 315 | 316 | phpfpm_configure_site_default() { 317 | if [ -z "${NGINX_SITE_ENABLED}" ] && [ ! -f "/etc/nginx/sites.available/default.conf" ] && [ -f "/etc/cont-init.d/20-php-fpm" ]; then 318 | cat < /etc/nginx/sites.available/default.conf 319 | server { 320 | ### Don't Touch This 321 | listen ${NGINX_LISTEN_PORT}; 322 | root ${NGINX_WEBROOT}; 323 | 324 | ### Populate your custom directives here 325 | index index.php index.html index.htm; 326 | 327 | location / { 328 | try_files \$uri \$uri/ /index.php?\$args; 329 | } 330 | 331 | ### Populate your custom directives here 332 | location ~ \.php(/|\$) { 333 | include /etc/nginx/snippets/php-fpm.conf; 334 | fastcgi_split_path_info ^(.+?\.php)(/.+)\$; 335 | fastcgi_param PATH_INFO \$fastcgi_path_info; 336 | fastcgi_index index.php; 337 | include fastcgi_params; 338 | fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; 339 | } 340 | 341 | ### Don't edit past here 342 | include /etc/nginx/snippets/site_optimization.conf; 343 | include /etc/nginx/snippets/exploit_protection.conf; 344 | } 345 | EOF 346 | NGINX_SITE_ENABLED=default 347 | nginx_site_enable default 348 | fi 349 | } 350 | 351 | phpfpm_post_init() { 352 | case ${os} in 353 | "alpine" ) 354 | cp -R /assets/php-fpm/cli/php.ini "${php_prefix}"/ 355 | cp -R /assets/php-fpm/mods-available/* "${php_prefix}"/mods-available/ 356 | cp -R /assets/php-fpm/fpm/php-fpm.conf "${php_prefix}"/ 357 | ;; 358 | "debian" ) 359 | cp -R /assets/php-fpm/* "${php_prefix}" 360 | ;; 361 | esac 362 | 363 | case ${os} in 364 | "alpine" ) 365 | ### Weird Opcache issue 366 | if [ -f "${php_prefix}/conf.d/10-opcache.ini" ] && [ -f "${php_prefix}/conf.d/00-opcache.ini" ] ; then 367 | rm -rf "${php_prefix}"/conf.d/00-opcache.ini 368 | fi 369 | ;; 370 | "debian" ) 371 | ### Weird Opcache issue 372 | if [ -f "/etc/php/${PHP_BASE}/fpm/conf.d/10-opcache.ini" ] && [ -f "/etc/php/${PHP_BASE}/fpm/conf.d/00-opcache.ini" ] ; then 373 | rm -rf /etc/php/"${PHP_BASE}"/*/conf.d/00-opcache.ini 374 | fi 375 | ;; 376 | esac 377 | 378 | if var_false "${PHP_KITCHENSINK}" ; then 379 | php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} 380 | unset PHP_ENABLE_CREATE_SAMPLE_PHP # legacy 381 | php_env_plugins_enabled=$(set -o posix; set | sort | grep PHP_ENABLE_ | grep -i TRUE |sed -e 's/PHP_ENABLE_//g' | sed -e 's/=TRUE//g' | awk -vRS="" -vOFS=', ' '$1=$1' | tr A-Z a-z) 382 | for module in $(echo "${php_env_plugins_enabled}" | tr "," "\n" ) ; do 383 | if [ -f "${php_prefix}"/mods-available/"${module}".ini ]; then 384 | print_debug "Enabling ${module}" 385 | silent php-ext enable "${module}" 386 | php_actual_plugins_enabled="${php_actual_plugins_enabled} ${module}" 387 | else 388 | print_error "Requested enabling ${module} however it doesn't exist!" 389 | fi 390 | done 391 | print_debug "PHP-FPM Preparing to start with the following extensions enabled: ${php_actual_plugins_enabled}" 392 | else 393 | php_enable_create_sample_php=${PHP_ENABLE_CREATE_SAMPLE_PHP} 394 | print_warn "Enabling Kitchen Sink mode and allowing all plugins to be active" 395 | silent php-ext enable all 396 | fi 397 | 398 | chmod -R 0755 "${php_prefix}" 399 | chown -R root:"${PHP_FPM_GROUP}" "${php_prefix}" 400 | 401 | if [ -n "${PHP_FPM_POST_INIT_SCRIPT}" ] ; then 402 | print_debug "Found Post Init Scripts" 403 | post_scripts=$(echo "${PHP_FPM_POST_INIT_SCRIPT}" | tr "," "\n") 404 | for post_script in $post_scripts; do 405 | if [ -f "${post_script}" ] ; then 406 | print_debug "Executing post init script '${post_script}'" 407 | chmod +x "${post_script}" 408 | "${post_script}" 409 | else 410 | print_error "Tried to run post script '${post_script}' but it does not exist!" 411 | fi 412 | done 413 | fi 414 | 415 | if [ -n "${PHP_FPM_POST_INIT_COMMAND}" ] ; then 416 | print_debug "Found Post Init Command" 417 | post_commands=$(echo "${PHP_FPM_POST_INIT_COMMAND}" | tr "," "\n") 418 | for post_command in $post_commands; do 419 | print_debug "Executing post init command '${post_command}'" 420 | "${post_command}" 421 | done 422 | fi 423 | } 424 | -------------------------------------------------------------------------------- /install/assets/php-fpm/cli/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | engine = On 4 | allow_url_fopen = On 5 | allow_url_include = Off 6 | asp_tags = Off 7 | auto_append_file = 8 | auto_globals_jit = On 9 | auto_prepend_file = 10 | cgi.discard_path = 1 11 | cgi.fix_pathinfo=0 12 | default_charset = "UTF-8" 13 | default_mimetype = "text/html" 14 | default_socket_timeout = 180 15 | disable_classes = 16 | disable_functions = 17 | display_errors = Off 18 | display_startup_errors = Off 19 | doc_root = 20 | enable_dl = Off 21 | error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 22 | expose_php = On 23 | file_uploads = On 24 | html_errors = On 25 | ignore_repeated_errors = Off 26 | ignore_repeated_source = Off 27 | implicit_flush = Off 28 | log_errors = On 29 | log_errors_max_len = 0 30 | max_execution_time = 30 31 | max_file_uploads = 20 32 | max_input_time = 180 33 | memory_limit = 128M 34 | output_buffering = 4096 35 | post_max_size = 2G 36 | precision = 14 37 | register_argc_argv = Off 38 | report_memleaks = On 39 | request_order = "GP" 40 | serialize_precision = 17 41 | short_open_tag = Off 42 | track_errors = Off 43 | unserialize_callback_func = 44 | upload_max_filesize = 2G 45 | user_dir = 46 | variables_order = "GPCS" 47 | zend.enable_gc = On 48 | zlib.output_compression = Off 49 | 50 | [CLI Server] 51 | cli_server.color = On 52 | 53 | [Date] 54 | date.timezone = UTC 55 | 56 | [filter] 57 | 58 | [iconv] 59 | 60 | [intl] 61 | 62 | [sqlite3] 63 | 64 | [Pcre] 65 | 66 | [Pdo] 67 | 68 | [Pdo_mysql] 69 | pdo_mysql.cache_size = 2000 70 | 71 | pdo_mysql.default_socket= 72 | 73 | [Phar] 74 | 75 | [mail function] 76 | SMTP = localhost 77 | smtp_port = 25 78 | 79 | ;sendmail_path = 80 | 81 | mail.add_x_header = On 82 | 83 | [SQL] 84 | sql.safe_mode = Off 85 | 86 | [ODBC] 87 | odbc.allow_persistent = On 88 | odbc.check_persistent = On 89 | odbc.max_persistent = -1 90 | odbc.max_links = -1 91 | odbc.defaultlrl = 4096 92 | odbc.defaultbinmode = 1 93 | 94 | 95 | [Interbase] 96 | ibase.allow_persistent = 1 97 | ibase.max_persistent = -1 98 | ibase.max_links = -1 99 | ibase.timestampformat = "%Y-%m-%d %H:%M:%S" 100 | ibase.dateformat = "%Y-%m-%d" 101 | ibase.timeformat = "%H:%M:%S" 102 | 103 | [MySQL] 104 | mysql.allow_local_infile = On 105 | mysql.allow_persistent = On 106 | mysql.cache_size = 2000 107 | mysql.max_persistent = -1 108 | mysql.max_links = -1 109 | mysql.default_port = 110 | mysql.default_socket = 111 | mysql.default_host = 112 | mysql.default_user = 113 | mysql.default_password = 114 | mysql.connect_timeout = 60 115 | mysql.trace_mode = Off 116 | 117 | [MySQLi] 118 | mysqli.max_persistent = -1 119 | mysqli.allow_persistent = On 120 | mysqli.max_links = -1 121 | mysqli.cache_size = 2000 122 | mysqli.default_port = 3306 123 | mysqli.default_socket = 124 | mysqli.default_host = 125 | mysqli.default_user = 126 | mysqli.default_pw = 127 | mysqli.reconnect = Off 128 | 129 | [mysqlnd] 130 | mysqlnd.collect_statistics = On 131 | mysqlnd.collect_memory_statistics = Off 132 | 133 | [OCI8] 134 | 135 | [PostgreSQL] 136 | pgsql.allow_persistent = On 137 | pgsql.auto_reset_persistent = Off 138 | pgsql.max_persistent = -1 139 | pgsql.max_links = -1 140 | pgsql.ignore_notice = 0 141 | pgsql.log_notice = 0 142 | 143 | [Sybase-CT] 144 | sybct.allow_persistent = On 145 | sybct.max_persistent = -1 146 | sybct.max_links = -1 147 | sybct.min_server_severity = 10 148 | sybct.min_client_severity = 10 149 | 150 | [bcmath] 151 | bcmath.scale = 0 152 | 153 | [browscap] 154 | 155 | [Session] 156 | session.save_handler = files 157 | session.use_strict_mode = 0 158 | session.use_cookies = 1 159 | session.use_only_cookies = 1 160 | session.name = PHPSESSID 161 | session.auto_start = 0 162 | session.cookie_lifetime = 0 163 | session.cookie_path = / 164 | session.cookie_domain = 165 | session.cookie_httponly = 166 | session.serialize_handler = php 167 | session.gc_probability = 1 168 | session.gc_divisor = 1000 169 | session.gc_maxlifetime = 1440 170 | session.referer_check = 171 | session.cache_limiter = nocache 172 | session.cache_expire = 180 173 | session.use_trans_sid = 0 174 | session.hash_function = 0 175 | session.hash_bits_per_character = 5 176 | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" 177 | 178 | [MSSQL] 179 | mssql.allow_persistent = On 180 | mssql.max_persistent = -1 181 | mssql.max_links = -1 182 | mssql.min_error_severity = 10 183 | mssql.min_message_severity = 10 184 | mssql.compatibility_mode = Off 185 | mssql.secure_connection = Off 186 | 187 | [Assertion] 188 | 189 | [COM] 190 | 191 | [mbstring] 192 | 193 | [gd] 194 | 195 | [exif] 196 | 197 | [Tidy] 198 | tidy.clean_output = Off 199 | 200 | [soap] 201 | soap.wsdl_cache_enabled=1 202 | soap.wsdl_cache_dir="/tmp" 203 | soap.wsdl_cache_ttl=86400 204 | soap.wsdl_cache_limit = 5 205 | 206 | [sysvshm] 207 | 208 | [ldap] 209 | ldap.max_links = -1 210 | 211 | [mcrypt] 212 | 213 | [dba] 214 | 215 | [opcache] 216 | 217 | [curl] 218 | 219 | [openssl] 220 | 221 | -------------------------------------------------------------------------------- /install/assets/php-fpm/fpm/default.logformat: -------------------------------------------------------------------------------- 1 | access.format='%{%Y-%m-%dT%H:%M:%S%z}T %{HTTP_X_FORWARDED_FOR}e %R %u %s %m "%{REQUEST_URI}e" %{HTTP_X_REQUEST_ID}e %{SERVER_PROTOCOL}e %l "%{HTTP_REFERER}e" "%{HTTP_USER_AGENT}e" %M %C %d' -------------------------------------------------------------------------------- /install/assets/php-fpm/fpm/json.logformat: -------------------------------------------------------------------------------- 1 | access.format='{"time":"%{%Y-%m-%dT%H:%M:%S%z}T","remote_addr":"%{HTTP_X_FORWARDED_FOR}","client_ip":"%R","remote_user":"%u","status":"%s","request_method":"%m","request_uri":"%{REQUEST_URI}e","request_id":"%{HTTP_X_REQUEST_ID}e","server_protocol":"%{SERVER_PROTOCOL}e","body_bytes_sent":"%l","http_referrer":"%{HTTP_REFERER}e","http_user_agent":"%{HTTP_USER_AGENT}e","memory_usage":"%M","cpu_usage":"%C","duration":"%d"}' -------------------------------------------------------------------------------- /install/assets/php-fpm/fpm/php-fpm.conf: -------------------------------------------------------------------------------- 1 | error_log = {{PHP_LOG_LOCATION}}/{{PHP_LOG_ERROR_FILE}} 2 | log_level = {{PHP_LOG_LEVEL}} 3 | log_limit = {{PHP_LOG_LIMIT}} 4 | 5 | [www] 6 | listen = {{PHP_FPM_LISTEN_UNIX_SOCKET}} 7 | listen = {{PHP_FPM_LISTEN_TCP_IP}}:{{PHP_FPM_LISTEN_TCP_PORT}} 8 | listen.allowed_clients = {{PHP_FPM_LISTEN_TCP_IP_ALLOWED}} 9 | listen.owner = {{PHP_FPM_LISTEN_UNIX_USER}} 10 | listen.group = {{PHP_FPM_LISTEN_UNIX_GROUP}} 11 | 12 | access.log = {{PHP_LOG_LOCATION}}/{{PHP_LOG_ACCESS_FILE}} 13 | 14 | pm = {{PHP_FPM_PROCESS_MANAGER}} 15 | pm.max_children = {{PHP_FPM_MAX_CHILDREN}} 16 | pm.start_servers = {{PHP_FPM_START_SERVERS}} 17 | pm.min_spare_servers = {{PHP_FPM_MIN_SPARE_SERVERS}} 18 | pm.max_spare_servers = {{PHP_FPM_MAX_SPARE_SERVERS}} 19 | pm.status_path = /php-fpm_status 20 | ping.path = /ping 21 | 22 | pm.process_idle_timeout = 10s 23 | pm.max_requests = {{PHP_FPM_MAX_REQUESTS}} 24 | php_admin_value[max_execution_time] = {{PHP_TIMEOUT}} 25 | php_admin_value[max_input_nesting_level] = 256 26 | php_admin_value[max_input_vars] = 10000 27 | php_admin_value[memory_limit] = {{PHP_MEMORY_LIMIT}} 28 | php_admin_value[openssl.cafile] = /etc/ssl/certs/ca-certificates.crt 29 | php_admin_value[openssl.capath] = /etc/ssl/certs 30 | php_admin_value[output_buffering] = {{PHP_FPM_OUTPUT_BUFFER_SIZE}} 31 | php_admin_value[post_max_size] = {{PHP_POST_MAX_SIZE}} 32 | php_admin_value[upload_max_filesize] = {{PHP_UPLOAD_MAX_SIZE}} 33 | php_flag[display_errors] = {{PHP_DISPLAY_ERRORS}} 34 | catch_workers_output = yes 35 | 36 | env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 37 | env[TMP] = /tmp 38 | env[TMPDIR] = /tmp 39 | env[TEMP] = /tmp 40 | -------------------------------------------------------------------------------- /install/assets/php-fpm/fpm/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | engine = On 4 | allow_url_fopen = On 5 | allow_url_include = Off 6 | asp_tags = Off 7 | auto_append_file = 8 | auto_globals_jit = On 9 | auto_prepend_file = 10 | cgi.discard_path = 1 11 | cgi.fix_pathinfo=0 12 | default_charset = "UTF-8" 13 | default_mimetype = "text/html" 14 | default_socket_timeout = 180 15 | disable_classes = 16 | disable_functions = 17 | display_errors = Off 18 | display_startup_errors = Off 19 | doc_root = 20 | enable_dl = Off 21 | error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT 22 | expose_php = On 23 | file_uploads = On 24 | html_errors = On 25 | ignore_repeated_errors = Off 26 | ignore_repeated_source = Off 27 | implicit_flush = Off 28 | log_errors = On 29 | log_errors_max_len = 1024 30 | max_execution_time = 30 31 | max_file_uploads = 20 32 | max_input_time = 180 33 | memory_limit = 128M 34 | output_buffering = 4096 35 | post_max_size = 2G 36 | precision = 14 37 | register_argc_argv = Off 38 | report_memleaks = On 39 | request_order = "GP" 40 | serialize_precision = 17 41 | short_open_tag = Off 42 | track_errors = Off 43 | unserialize_callback_func = 44 | upload_max_filesize = 2G 45 | user_dir = 46 | variables_order = "GPCS" 47 | zend.enable_gc = On 48 | zlib.output_compression = Off 49 | 50 | [CLI Server] 51 | cli_server.color = On 52 | 53 | [Date] 54 | date.timezone = UTC 55 | 56 | [filter] 57 | 58 | [iconv] 59 | 60 | [intl] 61 | 62 | [sqlite3] 63 | 64 | [Pcre] 65 | 66 | [Pdo] 67 | 68 | [Pdo_mysql] 69 | pdo_mysql.cache_size = 2000 70 | 71 | pdo_mysql.default_socket= 72 | 73 | [Phar] 74 | 75 | [mail function] 76 | SMTP = localhost 77 | smtp_port = 25 78 | 79 | ;sendmail_path = 80 | 81 | mail.add_x_header = On 82 | 83 | [SQL] 84 | sql.safe_mode = Off 85 | 86 | [ODBC] 87 | odbc.allow_persistent = On 88 | odbc.check_persistent = On 89 | odbc.max_persistent = -1 90 | odbc.max_links = -1 91 | odbc.defaultlrl = 4096 92 | odbc.defaultbinmode = 1 93 | 94 | 95 | [Interbase] 96 | ibase.allow_persistent = 1 97 | ibase.max_persistent = -1 98 | ibase.max_links = -1 99 | ibase.timestampformat = "%Y-%m-%d %H:%M:%S" 100 | ibase.dateformat = "%Y-%m-%d" 101 | ibase.timeformat = "%H:%M:%S" 102 | 103 | [MySQL] 104 | mysql.allow_local_infile = On 105 | mysql.allow_persistent = On 106 | mysql.cache_size = 2000 107 | mysql.max_persistent = -1 108 | mysql.max_links = -1 109 | mysql.default_port = 110 | mysql.default_socket = 111 | mysql.default_host = 112 | mysql.default_user = 113 | mysql.default_password = 114 | mysql.connect_timeout = 60 115 | mysql.trace_mode = Off 116 | 117 | [MySQLi] 118 | mysqli.max_persistent = -1 119 | mysqli.allow_persistent = On 120 | mysqli.max_links = -1 121 | mysqli.cache_size = 2000 122 | mysqli.default_port = 3306 123 | mysqli.default_socket = 124 | mysqli.default_host = 125 | mysqli.default_user = 126 | mysqli.default_pw = 127 | mysqli.reconnect = Off 128 | 129 | [mysqlnd] 130 | mysqlnd.collect_statistics = On 131 | mysqlnd.collect_memory_statistics = Off 132 | 133 | [OCI8] 134 | 135 | [PostgreSQL] 136 | pgsql.allow_persistent = On 137 | pgsql.auto_reset_persistent = Off 138 | pgsql.max_persistent = -1 139 | pgsql.max_links = -1 140 | pgsql.ignore_notice = 0 141 | pgsql.log_notice = 0 142 | 143 | [Sybase-CT] 144 | sybct.allow_persistent = On 145 | sybct.max_persistent = -1 146 | sybct.max_links = -1 147 | sybct.min_server_severity = 10 148 | sybct.min_client_severity = 10 149 | 150 | [bcmath] 151 | bcmath.scale = 0 152 | 153 | [browscap] 154 | 155 | [Session] 156 | session.save_handler = files 157 | session.use_strict_mode = 0 158 | session.use_cookies = 1 159 | session.use_only_cookies = 1 160 | session.name = PHPSESSID 161 | session.auto_start = 0 162 | session.cookie_lifetime = 0 163 | session.cookie_path = / 164 | session.cookie_domain = 165 | session.cookie_httponly = 166 | session.serialize_handler = php 167 | session.gc_probability = 1 168 | session.gc_divisor = 1000 169 | session.gc_maxlifetime = 1440 170 | session.referer_check = 171 | session.cache_limiter = nocache 172 | session.cache_expire = 180 173 | session.use_trans_sid = 0 174 | session.hash_function = 0 175 | session.hash_bits_per_character = 5 176 | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" 177 | 178 | [MSSQL] 179 | mssql.allow_persistent = On 180 | mssql.max_persistent = -1 181 | mssql.max_links = -1 182 | mssql.min_error_severity = 10 183 | mssql.min_message_severity = 10 184 | mssql.compatibility_mode = Off 185 | mssql.secure_connection = Off 186 | 187 | [Assertion] 188 | 189 | [COM] 190 | 191 | [mbstring] 192 | 193 | [gd] 194 | 195 | [exif] 196 | 197 | [Tidy] 198 | tidy.clean_output = Off 199 | 200 | [soap] 201 | soap.wsdl_cache_enabled=1 202 | soap.wsdl_cache_dir="/tmp" 203 | soap.wsdl_cache_ttl=86400 204 | soap.wsdl_cache_limit = 5 205 | 206 | [sysvshm] 207 | 208 | [ldap] 209 | ldap.max_links = -1 210 | 211 | [mcrypt] 212 | 213 | [dba] 214 | 215 | [opcache] 216 | 217 | [curl] 218 | 219 | [openssl] 220 | 221 | -------------------------------------------------------------------------------- /install/assets/php-fpm/mods-available/apcu.ini: -------------------------------------------------------------------------------- 1 | extension=apcu.so 2 | apc.enabled=1 3 | apc.shm_size=128M 4 | apc.ttl=7200 5 | apc.enable_cli=1 6 | ;priority=20 7 | -------------------------------------------------------------------------------- /install/assets/php-fpm/mods-available/opcache.ini: -------------------------------------------------------------------------------- 1 | zend_extension=opcache.so 2 | opcache.enable=1 3 | opcache.enable_cli=1 4 | opcache.memory_consumption=128 5 | opcache.interned_strings_buffer=8 6 | opcache.max_accelerated_files=10000 7 | opcache.max_wasted_percentage=5 8 | opcache.validate_timestamps=1 9 | opcache.revalidate_freq=2 10 | opcache.save_comments=1 11 | opcache.optimization_level=0x7FFFBFFF 12 | opcache.max_file_size=0 13 | opcache.jit_buffer_size=0 14 | opcache.jit=1255 15 | ;priority=10 -------------------------------------------------------------------------------- /install/etc/cont-init.d/20-php-fpm: -------------------------------------------------------------------------------- 1 | #!/command/with-contenv bash 2 | 3 | source /assets/functions/00-container 4 | source /assets/defaults/10-nginx 5 | prepare_service 6 | PROCESS_NAME="php-fpm" 7 | 8 | if var_false "${ENABLE_PHP_FPM}" ; then 9 | print_notice "Disabling PHP-FPM Functionality" 10 | service_stop 20-php-fpm 11 | rm -rf /assets/logrotate/php-fpm* 12 | rm -rf /etc/logrotate.d/php-fpm* 13 | rm -rf /etc/fluent-bit/conf.d/php* 14 | rm -rf /etc/zabbix/*/php*.conf 15 | liftoff 16 | exit 0 17 | fi 18 | 19 | case "${PHP_FPM_CONTAINER_MODE,,}" in 20 | "nginx") 21 | print_warn "Setting Container to operate in Nginx standalone mode" 22 | if [ "${PHP_FPM_HOST}" = "127.0.0.1" ] || [ "${PHP_FPM_HOST}" = "localhost" ] ; then 23 | print_error "Your PHP_FPM_HOST variable is still set to 'localhost' Please change it to something else" 24 | exit 1 25 | fi 26 | service_stop "$(basename "$0")" 27 | rm -rf /etc/zabbix/zabbix_agent.conf.d/php-fpm.conf 28 | liftoff 29 | exit 0 30 | ;; 31 | "php-fpm") 32 | print_warn "Setting Container to operate in PHP-FPM standalone mode - You will need a seperate container for Nginx or another webserver to serve content" 33 | set -x 34 | mod_service_stop 10-nginx 35 | set +x 36 | print_notice "Setting PHP-FPM to serve from ${PHP_WEBROOT}" 37 | sed -i "/[www]#/achdir = ${PHP_WEBROOT}" /assets/php-fpm/fpm/php-fpm.conf 38 | rm -rf /etc/zabbix/zabbix_agent.conf.d/nginx.conf 39 | ;; 40 | esac 41 | 42 | if [ ! -f "/tmp/.container/container-restart" ] ; then 43 | phpfpm_bootstrap 44 | phpfpm_configure_server 45 | phpfpm_configure_extensions 46 | if [[ "${PHP_FPM_CONTAINER_MODE,,}" == *"nginx"* ]] ; then phpfpm_configure_nginx ; fi 47 | if [[ "${PHP_FPM_CONTAINER_MODE,,}" == *"php-fpm"* ]] ; then phpfpm_create_default_page ; fi 48 | if var_true "${NGINX_ENABLE_APPLICATION_CONFIGURATION}"; then 49 | if [ -n "${NGINX_WEBROOT_SUFFIX}" ]; then 50 | _nginx_webroot_original="${NGINX_WEBROOT}" 51 | NGINX_WEBROOT=${NGINX_WEBROOT}${NGINX_WEBROOT_SUFFIX} 52 | fi 53 | phpfpm_configure_site_default 54 | if [ -n "${NGINX_WEBROOT_SUFFIX}" ]; then 55 | NGINX_WEBROOT=${_nginx_webroot_original} 56 | fi 57 | fi 58 | if [ "${NGINX_AUTHENTICATION_TYPE,,}" = "llng" ] ; then phpfpm_configure_authentication ; fi 59 | phpfpm_configure_logging 60 | phpfpm_post_init 61 | fi 62 | 63 | liftoff -------------------------------------------------------------------------------- /install/etc/fluent-bit/parsers.d/php-fpm.conf: -------------------------------------------------------------------------------- 1 | [PARSER] 2 | Name php-fpm 3 | Format regex 4 | Regex ^(?