├── .editorconfig ├── .envrc ├── .gitattributes ├── .github ├── CODEOWNERS ├── lock.yml └── workflows │ ├── ci.yml │ └── stale.yml ├── .gitignore ├── .markdownlint-cli2.yaml ├── .mdlrc ├── .overcommit.yml ├── .vscode └── extensions.json ├── .yamllint ├── Berksfile ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── TESTING.md ├── UPGRADING.md ├── chefignore ├── documentation ├── .gitkeep ├── php_fpm_pool.md ├── php_ini.md ├── php_install.md ├── php_pear.md └── php_pear_channel.md ├── kitchen.dokken.yml ├── kitchen.exec.yml ├── kitchen.global.yml ├── kitchen.yml ├── libraries └── helpers.rb ├── metadata.rb ├── renovate.json ├── resources ├── fpm_pool.rb ├── ini.rb ├── install.rb ├── pear.rb └── pear_channel.rb ├── spec ├── libraries │ └── helpers_spec.rb └── spec_helper.rb ├── templates ├── centos │ └── php.ini.erb ├── debian │ └── php.ini.erb ├── default │ ├── extension.ini.erb │ ├── fpm-pool.conf.erb │ └── php.ini.erb ├── redhat │ └── php.ini.erb └── ubuntu │ └── php.ini.erb └── test ├── cookbooks └── test │ ├── metadata.rb │ └── recipes │ ├── community.rb │ └── default.rb └── integration ├── resource └── inspec │ └── php_spec.rb └── resource_community └── inspec └── php_spec.rb /.editorconfig: -------------------------------------------------------------------------------- 1 | # https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root=true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = true 10 | 11 | # 2 space indentation 12 | indent_style = space 13 | indent_size = 2 14 | 15 | # Avoid issues parsing cookbook files later 16 | charset = utf-8 17 | 18 | # Avoid cookstyle warnings 19 | trim_trailing_whitespace = true 20 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | use chefworkstation 2 | export KITCHEN_GLOBAL_YAML=kitchen.global.yml 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto eol=lf 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @sous-chefs/maintainers 2 | -------------------------------------------------------------------------------- /.github/lock.yml: -------------------------------------------------------------------------------- 1 | --- 2 | daysUntilLock: 365 3 | exemptLabels: [] 4 | lockLabel: false 5 | lockComment: > 6 | This thread has been automatically locked since there has not been 7 | any recent activity after it was closed. Please open a new issue for 8 | related bugs. 9 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: ci 3 | 4 | "on": 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | 10 | jobs: 11 | lint-unit: 12 | uses: sous-chefs/.github/.github/workflows/lint-unit.yml@3.1.1 13 | permissions: 14 | actions: write 15 | checks: write 16 | pull-requests: write 17 | statuses: write 18 | issues: write 19 | 20 | integration: 21 | needs: lint-unit 22 | runs-on: ubuntu-latest 23 | strategy: 24 | matrix: 25 | os: 26 | - almalinux-8 27 | - almalinux-9 28 | - centos-stream-9 29 | - debian-11 30 | - debian-12 31 | - fedora-latest 32 | - rockylinux-8 33 | - rockylinux-9 34 | - ubuntu-2004 35 | - ubuntu-2204 36 | - ubuntu-2404 37 | suite: 38 | - resource 39 | - resource-community 40 | - resource-peclchannel 41 | fail-fast: false 42 | 43 | steps: 44 | - name: Check out code 45 | uses: actions/checkout@v4 # v4 46 | - name: Install Chef 47 | uses: actionshub/chef-install@3.0.1 48 | - name: Dokken 49 | uses: actionshub/test-kitchen@3.0.0 50 | env: 51 | CHEF_LICENSE: accept-no-persist 52 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 53 | with: 54 | suite: ${{ matrix.suite }} 55 | os: ${{ matrix.os }} 56 | 57 | integration-amazonlinux: 58 | needs: lint-unit 59 | runs-on: ubuntu-24.04 60 | strategy: 61 | matrix: 62 | os: 63 | - amazonlinux-2023 64 | suite: 65 | - resource 66 | - resource-peclchannel 67 | fail-fast: false 68 | 69 | steps: 70 | - name: Check out code 71 | uses: actions/checkout@v4 # v4 72 | - name: Install Chef 73 | uses: actionshub/chef-install@3.0.1 74 | - name: Dokken 75 | uses: actionshub/test-kitchen@3.0.0 76 | env: 77 | CHEF_LICENSE: accept-no-persist 78 | KITCHEN_LOCAL_YAML: kitchen.dokken.yml 79 | with: 80 | suite: ${{ matrix.suite }} 81 | os: ${{ matrix.os }} 82 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Mark stale issues and pull requests 3 | 4 | "on": 5 | schedule: [cron: "0 0 * * *"] 6 | 7 | jobs: 8 | stale: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/stale@v9 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | close-issue-message: > 15 | Closing due to inactivity. 16 | If this is still an issue please reopen or open another issue. 17 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 18 | Thanks, Sous-Chefs. 19 | days-before-close: 7 20 | days-before-stale: 365 21 | stale-issue-message: > 22 | Marking stale due to inactivity. 23 | Remove stale label or comment or this will be closed in 7 days. 24 | Alternatively drop by the #sous-chefs channel on the [Chef Community Slack](http://community-slack.chef.io/) and we'll be happy to help! 25 | Thanks, Sous-Chefs. 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .config 3 | InstalledFiles 4 | pkg 5 | test/tmp 6 | test/version_tmp 7 | tmp 8 | _Store 9 | *~ 10 | *# 11 | .#* 12 | \#*# 13 | *.un~ 14 | *.tmp 15 | *.bk 16 | *.bkup 17 | 18 | # editor files 19 | .idea 20 | .*.sw[a-z] 21 | 22 | # ruby/bundler/rspec files 23 | .ruby-version 24 | .ruby-gemset 25 | .rvmrc 26 | Gemfile.lock 27 | .bundle 28 | *.gem 29 | coverage 30 | spec/reports 31 | 32 | # YARD / rdoc artifacts 33 | .yardoc 34 | _yardoc 35 | doc/ 36 | rdoc 37 | 38 | # chef infra stuff 39 | Berksfile.lock 40 | .kitchen 41 | kitchen.local.yml 42 | vendor/ 43 | .coverage/ 44 | .zero-knife.rb 45 | Policyfile.lock.json 46 | 47 | # vagrant stuff 48 | .vagrant/ 49 | .vagrant.d/ 50 | -------------------------------------------------------------------------------- /.markdownlint-cli2.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | ul-indent: false # MD007 3 | line-length: false # MD013 4 | no-duplicate-heading: false # MD024 5 | reference-links-images: false # MD052 6 | ignores: 7 | - .github/copilot-instructions.md 8 | -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD013", "~MD024" 2 | -------------------------------------------------------------------------------- /.overcommit.yml: -------------------------------------------------------------------------------- 1 | --- 2 | PreCommit: 3 | TrailingWhitespace: 4 | enabled: true 5 | YamlLint: 6 | enabled: true 7 | required_executable: "yamllint" 8 | ChefSpec: 9 | enabled: true 10 | required_executable: "chef" 11 | command: ["chef", "exec", "rspec"] 12 | Cookstyle: 13 | enabled: true 14 | required_executable: "cookstyle" 15 | command: ["cookstyle"] 16 | MarkdownLint: 17 | enabled: false 18 | required_executable: "npx" 19 | command: ["npx", "markdownlint-cli2", "'**/*.md'"] 20 | include: ["**/*.md"] 21 | 22 | CommitMsg: 23 | HardTabs: 24 | enabled: true 25 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "chef-software.chef", 4 | "rebornix.ruby", 5 | "editorconfig.editorconfig", 6 | "DavidAnson.vscode-markdownlint" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | rules: 4 | line-length: 5 | max: 256 6 | level: warning 7 | document-start: disable 8 | braces: 9 | forbid: false 10 | min-spaces-inside: 0 11 | max-spaces-inside: 1 12 | min-spaces-inside-empty: -1 13 | max-spaces-inside-empty: -1 14 | comments: 15 | min-spaces-from-content: 1 16 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'test', path: './test/cookbooks/test' 7 | end 8 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # PHP Cookbook CHANGELOG 2 | 3 | This file is used to list changes made in each version of the PHP cookbook. 4 | 5 | ## Unreleased 6 | 7 | ## 10.2.4 - *2024-12-05* 8 | 9 | ## 10.2.3 - *2024-11-18* 10 | 11 | Standardise files with files in sous-chefs/repo-management 12 | 13 | Standardise files with files in sous-chefs/repo-management 14 | 15 | ## 10.2.2 - *2024-11-10* 16 | 17 | ## 10.2.1 - *2024-11-10* 18 | 19 | ## 10.2.0 - *2024-11-07* 20 | 21 | ## 10.1.2 - *2024-11-06* 22 | 23 | - delay `phpX.Y-fpm` service restart upon configuration update 24 | 25 | ## 10.1.1 - *2024-08-01* 26 | 27 | - resolved cookstyle error: metadata.rb:14:20 refactor: `Chef/Correctness/SupportsMustBeFloat` 28 | 29 | ## 10.1.0 - *2024-07-31* 30 | 31 | - Support fedora platform 32 | - Update cicd platforms because of EOL 33 | 34 | ## 10.0.3 - *2024-07-29* 35 | 36 | Standardise files with files in sous-chefs/repo-management 37 | 38 | - Correct the php version for rhel9. Visible in the fpm pool 39 | 40 | ## 10.0.2 - *2024-05-23* 41 | 42 | - Fix typos in documentation for `php_install` and `php_ini` resources 43 | 44 | ## 10.0.1 - *2024-05-23* 45 | 46 | - Standardise files with files in sous-chefs/repo-management 47 | 48 | ## 10.0.0 - *2024-05-23* 49 | 50 | Standardise files with files in sous-chefs/repo-management 51 | 52 | - Convert cookbook to resource-based by replacing recipes and attributes 53 | - Add custom resources php_install and php_ini 54 | - Drop direct support for installation from community repos and source 55 | - Fix failing Actions 56 | - Drop support for CentOS 7, Debian 10, and Amazon Linux 2 57 | - Add support for AlmaLinux 9, CentOS Stream 9, Rocky Linux 9, and Ubuntu 24.04 58 | - Exclude Amazon Linux and Ubuntu 18.04 from community install tests because 59 | they aren't supported by the community repos 60 | 61 | ## 9.2.18 - *2024-05-03* 62 | 63 | ## 9.2.17 - *2024-05-03* 64 | 65 | ## 9.2.16 - *2023-09-28* 66 | 67 | ## 9.2.15 - *2023-09-04* 68 | 69 | ## 9.2.14 - *2023-08-30* 70 | 71 | ## 9.2.13 - *2023-07-10* 72 | 73 | ## 9.2.12 - *2023-05-17* 74 | 75 | ## 9.2.11 - *2023-05-03* 76 | 77 | ## 9.2.10 - *2023-04-07* 78 | 79 | Standardise files with files in sous-chefs/repo-management 80 | 81 | ## 9.2.9 - *2023-04-01* 82 | 83 | ## 9.2.8 - *2023-04-01* 84 | 85 | ## 9.2.7 - *2023-04-01* 86 | 87 | Standardise files with files in sous-chefs/repo-management 88 | 89 | ## 9.2.6 - *2023-03-15* 90 | 91 | Standardise files with files in sous-chefs/repo-management 92 | 93 | Standardise files with files in sous-chefs/repo-management 94 | 95 | Standardise files with files in sous-chefs/repo-management 96 | 97 | ## 9.2.5 - *2023-02-20* 98 | 99 | Standardise files with files in sous-chefs/repo-management 100 | 101 | ## 9.2.4 - *2023-02-16* 102 | 103 | Standardise files with files in sous-chefs/repo-management 104 | 105 | ## 9.2.3 - *2023-02-15* 106 | 107 | Standardise files with files in sous-chefs/repo-management 108 | 109 | ## 9.2.2 - *2023-01-26* 110 | 111 | - Misc cleanup 112 | 113 | ## 9.2.1 - *2022-12-08* 114 | 115 | - Standardise files with files in sous-chefs/repo-management 116 | 117 | ## 9.2.0 - *2022-06-14* 118 | 119 | - Add support for Ubuntu 22.04 120 | - Update tested platforms 121 | - added: Ubuntu 22.04 122 | 123 | ## 9.1.4 - *2022-04-20* 124 | 125 | - Standardise files with files in sous-chefs/repo-management 126 | 127 | ## 9.1.3 - *2022-02-17* 128 | 129 | - Standardise files with files in sous-chefs/repo-management 130 | 131 | ## 9.1.2 - *2022-02-08* 132 | 133 | - Switch to using reusable CI workflow 134 | - Update tested platforms 135 | - removed: CentOS 8, Debian 9 136 | - added: CentOS Stream 8, Rocky / Alma 8, Debian 11 137 | 138 | ## 9.1.1 - *2022-02-08* 139 | 140 | - Remove delivery folder 141 | 142 | ## 9.1.0 - *2021-11-13* 143 | 144 | - Reenable community package recipe for CentOS 8 145 | - Bumps `yum-remi-chef` dependency to >= 5.0.1 146 | 147 | ## 9.0.0 - *2021-09-08* 148 | 149 | - Enable `unified_mode` for Chef 17 compatibility 150 | - Remove EOL Ubuntu 16.04 from testing 151 | - Add missing attributes to Ubuntu community package test 152 | - Add missing suites to GH Actions 153 | 154 | ## 8.1.2 - *2021-08-30* 155 | 156 | - Standardise files with files in sous-chefs/repo-management 157 | 158 | ## 8.1.1 - *2021-06-01* 159 | 160 | - Standardise files with files in sous-chefs/repo-management 161 | 162 | ## 8.1.0 - *2021-04-22* 163 | 164 | - Add ability to use community repositories to install newer versions of PHP 165 | 166 | ## 8.0.1 (2020-11-12) 167 | 168 | - Prevent Apache from being pulled in as a dependency on Ubuntu 20.04 (#311) 169 | 170 | ## 8.0.0 (2020-07-09) 171 | 172 | - Drop support for: 173 | - Debian 8 174 | - Ubuntu < 16.04 175 | - Amazon Linux 1 176 | - Set default PHP version to 7.2.x 177 | - Update Ubuntu 18.04 support to source build PHP 7.2 178 | - Update attributes for Debian 10 179 | - Add support for Ubuntu 20.04 180 | - Only symlink GMP on Ubuntu 16.04 to aid source builds 181 | - Drop support for installing from source on Debian 9 182 | 183 | ## 7.2.0 (2020-06-19) 184 | 185 | - Include extension priority on the specified format to the extension file 186 | 187 | ## 7.1.0 (2020-05-05) 188 | 189 | - Split out resource documentation into the documentation folder 190 | - Run cookstyle 0.75.1 191 | - Fix dependency problem with installing php from source on ubuntu 18.04 192 | - Simplify platform checks 193 | - Remove unused long_description metadata from metadata.rb 194 | - Migrated to Github Actions for testing 195 | - Adding control of php-fpm php.ini with specific attribute 196 | 197 | ## 7.0.0 (2019-08-07) 198 | 199 | - *Drop support for Chef 13* so we don't need to require build essentials 200 | - Sync php.ini template with php.ini-production from php-7.2.18 201 | 202 | ## 6.1.1 (2018-08-07) 203 | 204 | - Pass in missing argument to manage_pecl_ini method when trying to remove a module 205 | 206 | ## 6.1.0 (2018-07-24) 207 | 208 | - Allow default recipe to skip pear channel configuration 209 | 210 | ## 6.0.0 (2018-04-16) 211 | 212 | ### Breaking Change 213 | 214 | This release removes the previous recipes in this cookbook for setting up various PEAR extensions. These should now be setup using the php_pear module directly and not done by adding various recipes / manipulating attributes 215 | 216 | ### Other Changes 217 | 218 | - Use the build_essential resource directly so we can call this from Chef itself on Chef 14 219 | - Add specs for additional platforms 220 | - Move the helpers back into the resources which makes them easier to ship in Chef later 221 | - Break out logic in the channel resource into a helper 222 | - Add support for Amazon Linux 2 223 | 224 | ## 5.1.0 (2018-04-05) 225 | 226 | - Don't eval the action_class 227 | - use php pear binary property in all recipes 228 | - Remove incorrect not_if in the php_pear resource 229 | - More testing updates 230 | - Initial support for Ubuntu 18.04 231 | 232 | ## 5.0.0 (2018-02-15) 233 | 234 | - Simplify this cookbook to remove the dependency on mysql cookbook, and remove the database dependencies in the recipes and attributes. This will allow folks who are using the mysql cookbook to be able to upgrade as needed (or pin to earlier versions). As this is a big change, pin to an earlier version if you need the mysql support that was previously available in this cookbook. Future versions may contain a resource that allows for recompiling php with the necessary extensions. 235 | - Usage of `node['php']['pear']` in the php_pear resource has been replaced with a new 'binary' property for specifying the path to the binary 236 | - Added a new `priority` property to the php_pear resource 237 | 238 | ## 4.6.0 (2018-02-07) 239 | 240 | - Converted the php_pear resource to a custom resource 241 | - Moved all helper logic out of the resource and into its own helper library file 242 | - Fix source install on Ubuntu by making sure we have xml2-config package 243 | - Remove options that are no longer recognised by the php installer when installing from source 244 | - Remove matchers as we no longer require them with a modern ChefDK 245 | 246 | ## 4.5.0 (2017-07-11) 247 | 248 | - Add reinstall chefspec matcher 249 | - Switch from maintainers files to a simple readme section 250 | - Remove allow_call_time_pass_reference and y2k_compliance config on Debian/Ubuntu as no supported PHP version supports it 251 | - Initial Debian 9 support 252 | 253 | ## 4.4.0 (2017-06-27) 254 | 255 | - Add a reinstall action to php_pear 256 | - Added additional specs for package installs on different platforms 257 | 258 | ## 4.3.0 (2017-06-27) 259 | 260 | - Remove fallback default php attributes that were used if we were on an unsupported platform. If we don't know the platform we don't support it and we should fail until we add proper support 261 | - Add a few attributes needed for fpm support on opensuse. This is a work in progress to get full PHP support on opensuse 262 | - Install xml deps and avoid using xml cookbook since it's been deprecated 263 | - Expand the php_pear testing 264 | - Remove double logging and log the correct package name in php_pear resource 265 | - Cleanup readme example codes, improve formatting and remove references to LWRPs as they are just resources now 266 | 267 | ## 4.2.0 (2017-05-30) 268 | 269 | - Make sure package intalls, php-fpm, and source installs work on Amazon linux 270 | - Avoid symlink warning in the converges 271 | - Simplify the package install logic 272 | - Rename the inspec test to match the suite name so it actually runs 273 | - Test on FreeBSD 11 / Amazon Linux 274 | - Install 5.6.30 by default on source installs 275 | 276 | ## 4.1.0 (2017-05-30) 277 | 278 | - Remove class_eval usage and require Chef 12.7+ 279 | 280 | ## 4.0.0 (2017-04-20) 281 | 282 | - Fix pear_channel resource to not fail on Chef 12.5 and 12.6 283 | - Remove support for RHEL 5 as it is now EOL 284 | - Resolve Amazon Linux failures on Chef 13 285 | - Convert fpm_pool to a custom resource 286 | - Fix php_pear failures on Chef 13 287 | - Remove non-functional support for Windows 288 | - Remove redundant Ubuntu version checks in the php_pear provider 289 | - Expand testing to test all of the resources 290 | 291 | ## 3.1.1 (2017-04-20) 292 | 293 | - Use the cookbook attribute as the default value of pear_channel pear property to provide better platform support 294 | 295 | ## 3.1.0 (2017-04-10) 296 | 297 | - Use multi-package installs on supported platform_family(rhel debian suse amazon) 298 | - Use a SPDX standardized license string in the metadata 299 | - Update specs for the new Fauxhai data 300 | 301 | ## 3.0.0 (2017-03-27) 302 | 303 | - Converted pear_channel LWRP into custom resource 304 | - Removed use of pear node attribute from pear_channel resource 305 | - Fix cookstyle issue with missing line on metadata.rb 306 | - Clean up kitchen.dokken.yml file to eliminate duplication of testing suites. 307 | - Eliminate duplicated resource from test cookbook that is in the default recipe. 308 | - Rename php-test to standard cookbook testing cookbook of "test" 309 | - Remove EOL ubuntu platform logic 310 | 311 | **NOTE** Windows package installation is currently broken. 312 | 313 | ## 2.2.1 (2017-02-21) 314 | 315 | - Fix double definition of ['php']['packages'] for rhel. 316 | 317 | ## 2.2.0 (2016-12-12) 318 | 319 | - Use multipackage for installs to speed up chef runs 320 | - Use all CPUs when building from source 321 | - Remove need for apt/yum in testing 322 | - Add opensuse to the metadata 323 | - Migrate to inspec for integration testing 324 | 325 | ## 2.1.1 (2016-09-15) 326 | 327 | - Fix recompile un-pack php creates 328 | - Resolve cookstyle warnings 329 | 330 | ## 2.1.0 (2016-09-14) 331 | 332 | - Fix source php version check 333 | - Require Chef 12.1 not 12.0 334 | 335 | ## 2.0.0 (2016-09-07) 336 | 337 | - Require Chef 12+ 338 | - Remove the dependency on the Windows cookbook which isn't necessary with Chef 12+ 339 | 340 | ## 1.10.1 (2016-08-30) 341 | 342 | - [fix] bug fixes related with Ubuntu 16.04 and PHP 7 support 343 | - adding validator to listen attribute 344 | - Fix node.foo.bar warnings 345 | 346 | ## v1.10.0 (2016-07-27) 347 | 348 | - PR #167 Preventing user specified pool of www from being deleted at the end of the chef run on the first install 349 | - PR #122 Add recipe for php module_imap 350 | - PR #172 Fix uninstall action for resource php_fpm_pool 351 | 352 | ## v1.9.0 (2016-05-12) 353 | 354 | Special thanks to @ThatGerber for getting the PR for this release together 355 | 356 | - Added support for Ubuntu 16.04 and PHP 7 357 | - Added support for different listen user/groups with FPM 358 | - Cleaned up resource notification in the pear_channel provider to simplify code 359 | - Fixed Ubuntu 14.04+ not being able to find the GMP library 360 | 361 | ## v1.8.0 (2016-02-25) 362 | 363 | - Bumped the source install default version from 5.5.9 to 5.6.13 364 | - Added a chefignore file to limit the files uploaded to the Chef server 365 | - Added source_url and issues_url to the metadata.rb 366 | - Added additional Chefspec matchers 367 | - Added a Chef standard rubocop.yml file and resolved warnings 368 | - Added serverspec for integration testing 369 | - Remove legacy cloud Test Kitchen configs 370 | - Added testing in Travis CI with kitchen-docker 371 | - Added additional test suites to the Test Kitchen config 372 | - Updated contributing and testing documentation 373 | - Updated testing gem dependencies to the latest 374 | - Added maintainers.md and maintainers.toml files 375 | - Remove gitter chat from the readme 376 | - Add cookbook version badge to the readme 377 | - Added Fedora as a supported platform in the readme 378 | - Add missing cookbook dependencies to the readme 379 | 380 | ## v1.7.2 (2015-8-24) 381 | 382 | - Correct spelling in fpm_pool_start_servers (was servres) 383 | 384 | ## v1.7.1 (2015-8-17) 385 | 386 | - Correct permissions on ext_conf_dir folder (644 -> 755) 387 | 388 | ## v1.7.0 (2015-7-31) 389 | 390 | - NOTICE - This version changes the way the ['php']['directives'] is placed into configuration files. Quotes are no longer automatically placed around these aditional directives. Please take care when rolling out this version. 391 | - Allow additional PHP FPM config 392 | - Add recipe to recompile PHP from source 393 | - Move source dependencies to attributes file 394 | - Misc bug fixes 395 | 396 | ## v1.6.0 (2015-7-6) 397 | 398 | - Added ChefSpec matchers 399 | - Added basic PHP-FPM Support (Pre-Release) 400 | - Added support for FreeBSD 401 | - Updated cookbook to use MySQL 6.0 cookbook 402 | - Update cookbook to use php5enmod on supported platforms 403 | - Allow users to override php-mysql package 404 | 405 | ## v1.5.0 (2014-10-06) 406 | 407 | - Adding package_options attribute, utilizing in package resource 408 | 409 | ## v1.4.6 (2014-03-19) 410 | 411 | - [COOK-4436] - Test this cookbook, not yum. Also test Fedora 20. 412 | - [COOK-4427] - Add oracle as supported operating system 413 | 414 | ## v1.4.4 (2014-03-12) 415 | 416 | - [COOK-4393] - Fix convergence bug in source install 417 | 418 | ## v1.4.2 (2014-02-27) 419 | 420 | [COOK-4300] - Simplified and fixed pear/pecl logic. [Fixes #56 / #57] 421 | 422 | ## v1.4.0 (2014-02-27) 423 | 424 | [COOK-3639] - Allow users to specify php.ini source template 425 | 426 | ## v1.3.14 (2014-02-21) 427 | 428 | ### Bug 429 | 430 | - [COOK-4186] - Upgrade_package concatenates an empty version string when version is not set or is empty. 431 | 432 | ## v1.3.12 (2014-01-28) 433 | 434 | Fix github issue 'Cannot find a resource for preferred_state' 435 | 436 | ## v1.3.10 437 | 438 | Fixing my stove 439 | 440 | ## v1.3.8 441 | 442 | Version bump to ensure artifact sanity 443 | 444 | ## v1.3.6 445 | 446 | Version bump for toolchain 447 | 448 | ## v1.3.4 449 | 450 | Adding platform_family check to include_recipe in source.rb 451 | 452 | ## v1.3.2 453 | 454 | Fixing style cops. Updating test harness 455 | 456 | ## v1.3.0 457 | 458 | ### Bug 459 | 460 | - [COOK-3479] - Added Windows support to PHP 461 | - [COOK-2909] - Warnings about Chef::Exceptions::ShellCommandFailed is deprecated 462 | 463 | ## v1.2.6 464 | 465 | ### Bug 466 | 467 | - [COOK-3628] - Fix PHP download URL 468 | - [COOK-3568] - Fix Test Kitchen tests 469 | - [COOK-3402] - When the `ext_dir` setting is present, configure php properly for the source recipe 470 | - [COOK-2926] - Fix pear package detection when installing specific version 471 | 472 | ## v1.2.4 473 | 474 | ### Improvement 475 | 476 | - [COOK-3047] - Sort directives in `php.ini` 477 | - [COOK-2928] - Abstract `php.ini` directives into variables 478 | 479 | ### Bug 480 | 481 | - [COOK-2378] - Fix `php_pear` for libevent 482 | 483 | ## v1.2.2 484 | 485 | ### Bug 486 | 487 | - [COOK-3050]: `lib_dir` declared in wrong place for redhat 488 | - [COOK-3102]: remove fileinfo recipe from php cookbook 489 | 490 | ### Improvement 491 | 492 | - [COOK-3101]: use a method to abstract range of "el 5" versions in php recipes 493 | 494 | ## v1.2.0 495 | 496 | ### Improvement 497 | 498 | - [COOK-2516]: Better support for SUSE distribution for php cookbook 499 | - [COOK-3035]: update php::source to install 5.4.15 by default 500 | 501 | ### Bug 502 | 503 | - [COOK-2463]: PHP PEAR Provider Installs Most Recent Version, Without Respect to Preferred State 504 | - [COOK-2514]: php_pear: does not handle more exotic version strings 505 | 506 | ## v1.1.8 507 | 508 | - [COOK-1998] - Enable override of PHP packages in attributes 509 | 510 | ## v1.1.6 511 | 512 | - [COOK-2324] - adds Oracle linux support 513 | 514 | ## v1.1.4 515 | 516 | - [COOK-2106] - `php_pear` cannot find available packages 517 | 518 | ## v1.1.2 519 | 520 | - [COOK-1803] - use better regexp to match package name 521 | - [COOK-1926] - support Amazon linux 522 | 523 | ## v1.1.0 524 | 525 | - [COOK-543] - php.ini template should be configurable 526 | - [COOK-1067] - support for PECL zend extensions 527 | - [COOK-1193] - update package names for EPEL 6 528 | - [COOK-1348] - rescue Mixlib::ShellOut::ShellCommandFailed (chef 0.10.10) 529 | - [COOK-1465] - fix pear extension template 530 | 531 | ## v1.0.2 532 | 533 | - [COOK-993] Add mhash-devel to centos php source libs 534 | - [COOK-989] - bump version of php to 5.3.10 535 | - Also download the .tar.gz instead of .tar.bz2 as bzip2 may not be in the base OS (e.g., CentOS 6 minimal) 536 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Community Guidelines 2 | 3 | This project follows the Chef Community Guidelines 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please refer to 4 | [https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/CONTRIBUTING.MD) 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # php Cookbook 2 | 3 | [![Cookbook Version](https://img.shields.io/cookbook/v/php.svg)](https://supermarket.chef.io/cookbooks/php) 4 | [![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/php/master.svg)](https://circleci.com/gh/sous-chefs/php) 5 | [![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers) 6 | [![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors) 7 | [![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0) 8 | 9 | The `php` cookbook installs and configures PHP and the PEAR package management system. Also includes resources for managing PEAR (and PECL) packages, PECL channels, and PHP-FPM pools. 10 | 11 | ## Maintainers 12 | 13 | This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF). 14 | 15 | ## Requirements 16 | 17 | ### Platforms 18 | 19 | - Ubuntu 18.04 / 20.04 / 22.04 20 | - Debian 10 / 11 21 | - CentOS 7+ (incl. Alma & Rocky) 22 | - Amazon Linux 2023 23 | 24 | ### Chef 25 | 26 | - Chef 15.3+ 27 | 28 | ## Resources 29 | 30 | This cookbook includes resources for managing: 31 | 32 | - [php_ini](documentation/php_ini.md) 33 | - [php_install](documentation/php_install.md) 34 | - [php_pear](documentation/php_pear.md) 35 | - [php_pear_channel](documentation/php_pear_channel.md) 36 | - [php_fpm_pool](documentation/php_fpm_pool.md) 37 | 38 | ## Usage 39 | 40 | 41 | Simply use the `php_install` resource wherever you would like PHP installed from a package. By default, it will install from the platform's package manager (see [`libraries/helpers.rb`](https://github.com/sous-chefs/php/tree/main/libraries/helpers.rb) to see the default packages list for each platoform). 42 | 43 | Please see [`test/cookbooks/test/recipes/community.rb`](https://github.com/sous-chefs/php/tree/main/test/cookbooks/test/recipes/community.rb) for an example of using the `php_install` resource to install the desired version of PHP & its supporting packages from a community repository, and please refer to the documentation on these community repositories: 44 | 45 | - RHEL/CentOS - [Remi’s RPM repository](https://rpms.remirepo.net) 46 | - Ubuntu - [Ondřej Surý PPA](https://launchpad.net/~ondrej/+archive/ubuntu/php) 47 | - Debian - [Sury repo](https://deb.sury.org/) 48 | 49 | ## Contributors 50 | 51 | This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false) 52 | 53 | ### Backers 54 | 55 | Thank you to all our backers! 56 | 57 | ![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40) 58 | 59 | ### Sponsors 60 | 61 | Support this project by becoming a sponsor. Your logo will show up here with a link to your website. 62 | 63 | ![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100) 64 | ![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100) 65 | ![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100) 66 | ![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100) 67 | ![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100) 68 | ![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100) 69 | ![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100) 70 | ![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100) 71 | ![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100) 72 | ![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100) 73 | -------------------------------------------------------------------------------- /TESTING.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | Please refer to [the community cookbook documentation on testing](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/main/TESTING.MD). 4 | -------------------------------------------------------------------------------- /UPGRADING.md: -------------------------------------------------------------------------------- 1 | # Upgrading 2 | 3 | The `package` and `ini` recipes have been removed and replaced with custom resources: 4 | 5 | - package --> php_install 6 | - ini --> php_ini 7 | 8 | ## Attributes 9 | 10 | Attributes have been converted to resource properties; default values are set in helpers. Please see the documentation for all properties and their defaults. 11 | 12 | The following table lists the resources and properties that attributes have been moved to: 13 | 14 | | Attribute | Resource | Property Name (if different) | 15 | | ----------------------| -------------------------------------------- | ---------------------------- | 16 | | ['bin'] | Removed | | 17 | | ['checksum'] | Removed | | 18 | | ['conf_dir'] | php_ini, php_install, php_pear | | 19 | | ['configure_options'] | Removed | | 20 | | ['directives'] | php_fpm_pool, php_ini, php_install, php_pear | | 21 | | ['disable_mod'] | php_pear | | 22 | | ['enable_mod'] | php_pear | | 23 | | ['ext_conf_dir'] | php_pear | | 24 | | ['ext_dir'] | php_fpm_pool, php_ini, php_install | | 25 | | ['fpm_conf_dir'] | php_fpm_pool | | 26 | | ['fpm_default_conf'] | php_fpm_pool | :default_conf | 27 | | ['fpm_group'] | php_fpm_pool | :group | 28 | | ['fpm_ini_control'] | php_fpm_pool | | 29 | | ['fpm_listen_group'] | php_fpm_pool | :listen_group | 30 | | ['fpm_listen_user'] | php_fpm_pool | :listen_user | 31 | | ['fpm_package'] | php_fpm_pool | | 32 | | ['fpm_pool_dir'] | php_fpm_pool | :pool_dir | 33 | | ['fpm_service'] | php_fpm_pool | :service | 34 | | ['fpm_socket'] | php_fpm_pool | :listen | 35 | | ['fpm_user'] | php_fpm_pool | :user | 36 | | ['ini']['cookbook'] | php_fpm_pool, php_ini, php_install | :ini_cookbook | 37 | | ['ini']['template'] | php_fpm_pool, php_ini, php_install | :ini_template | 38 | | ['install_method'] | Removed | | 39 | | ['packages'] | php_install | | 40 | | ['pear'] | Removed | | 41 | | ['pear_channels'] | Removed | | 42 | | ['pear_setup'] | Removed | | 43 | | ['pecl'] | php_pear | | 44 | | ['prefix_dir'] | Removed | | 45 | | ['src_deps'] | Removed | | 46 | | ['src_recompile'] | Removed | | 47 | | ['url'] | Removed | | 48 | | ['version'] | Helper - versions now follow X.X format | php_version | 49 | 50 | Attributes specific to recipes or installing from source were removed. 51 | 52 | ## Package Install 53 | 54 | Installing from package managers can now be done through the `php_install` resource. 55 | 56 | ```ruby 57 | # Old Style 58 | include_recipe 'php::default' 59 | ``` 60 | 61 | ```ruby 62 | # New Style 63 | php_install 'php' do 64 | action :install 65 | end 66 | ``` 67 | 68 | ## Community Install 69 | 70 | Installing from community repos is no longer built in to the cookbook. The `php_install` resource can be configured to help in installing from community repos. See [`test/cookbooks/test/recipes/community.rb`](https://github.com/sous-chefs/php/tree/main/test/cookbooks/test/recipes/community.rb) for an example of fetching and installing from community repos. 71 | 72 | ## Source Install 73 | 74 | Installing from source is no longer built in to the cookbook. Users should manage installation from source on their own. The original recipe can be referenced [here](https://github.com/sous-chefs/php/blob/9.2.16/recipes/source.rb) to help with the switch. 75 | 76 | ## .ini Configuration 77 | 78 | Configuring PHP and FPM can now be done through the `php_ini` resource. 79 | 80 | ```ruby 81 | # Old Style 82 | include_recipe 'php::ini' 83 | ``` 84 | 85 | ```ruby 86 | # New Style 87 | php_ini 'php' do 88 | action :add 89 | end 90 | ``` 91 | 92 | A `.ini` file can also be removed using the `php_ini` resource. 93 | 94 | ```ruby 95 | # New Style 96 | php_ini 'php' do 97 | action :remove 98 | end 99 | ``` 100 | 101 | The `node['php']['fpm_ini_control']` attribute has been moved to a property of the `php_fpm_pool` resource. 102 | 103 | ```ruby 104 | # Old Style 105 | node['php']['fpm_ini_control'] = true 106 | include_recipe 'php::ini' 107 | ``` 108 | 109 | ```ruby 110 | # New Style 111 | php_fpm_pool 'fpm_pool' do 112 | fpm_ini_control true 113 | action :install 114 | end 115 | ``` 116 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # to a Chef Infra Server or Supermarket. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | ehthumbs.db 9 | Icon? 10 | nohup.out 11 | Thumbs.db 12 | .envrc 13 | 14 | # EDITORS # 15 | ########### 16 | .#* 17 | .project 18 | .settings 19 | *_flymake 20 | *_flymake.* 21 | *.bak 22 | *.sw[a-z] 23 | *.tmproj 24 | *~ 25 | \#* 26 | REVISION 27 | TAGS* 28 | tmtags 29 | .vscode 30 | .editorconfig 31 | 32 | ## COMPILED ## 33 | ############## 34 | *.class 35 | *.com 36 | *.dll 37 | *.exe 38 | *.o 39 | *.pyc 40 | *.so 41 | */rdoc/ 42 | a.out 43 | mkmf.log 44 | 45 | # Testing # 46 | ########### 47 | .circleci/* 48 | .codeclimate.yml 49 | .delivery/* 50 | .foodcritic 51 | .kitchen* 52 | .mdlrc 53 | .overcommit.yml 54 | .rspec 55 | .rubocop.yml 56 | .travis.yml 57 | .watchr 58 | .yamllint 59 | azure-pipelines.yml 60 | Dangerfile 61 | examples/* 62 | features/* 63 | Guardfile 64 | kitchen*.yml 65 | mlc_config.json 66 | Procfile 67 | Rakefile 68 | spec/* 69 | test/* 70 | 71 | # SCM # 72 | ####### 73 | .git 74 | .gitattributes 75 | .gitconfig 76 | .github/* 77 | .gitignore 78 | .gitkeep 79 | .gitmodules 80 | .svn 81 | */.bzr/* 82 | */.git 83 | */.hg/* 84 | */.svn/* 85 | 86 | # Berkshelf # 87 | ############# 88 | Berksfile 89 | Berksfile.lock 90 | cookbooks/* 91 | tmp 92 | 93 | # Bundler # 94 | ########### 95 | vendor/* 96 | Gemfile 97 | Gemfile.lock 98 | 99 | # Policyfile # 100 | ############## 101 | Policyfile.rb 102 | Policyfile.lock.json 103 | 104 | # Documentation # 105 | ############# 106 | CODE_OF_CONDUCT* 107 | CONTRIBUTING* 108 | documentation/* 109 | TESTING* 110 | UPGRADING* 111 | 112 | # Vagrant # 113 | ########### 114 | .vagrant 115 | Vagrantfile 116 | -------------------------------------------------------------------------------- /documentation/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sous-chefs/php/3332358649f7e59306c072213660199b99f6e5a9/documentation/.gitkeep -------------------------------------------------------------------------------- /documentation/php_fpm_pool.md: -------------------------------------------------------------------------------- 1 | # `php_fpm_pool` 2 | 3 | Installs the `php-fpm` package appropriate for your platform and configures a FPM pool for you. Currently only supported in Debian-family operating systems and CentOS 7 (or at least tested with such). 4 | 5 | Please consider FPM functionally pre-release, and test it thoroughly in your environment before using it in production 6 | 7 | More info: 8 | 9 | ## Actions 10 | 11 | - `:install`: Installs the FPM pool (default). 12 | - `:uninstall`: Removes the FPM pool. 13 | 14 | ## Properties 15 | 16 | | Name | Type | Default | Description | 17 | | ------------------- | --------------- | ------------------------------------ | ------------------------------------------------------------------------------------- | 18 | | `pool_name` | `String` | The name of the FPM pool | | 19 | | `listen` | `String` | `/var/run/php-fpm.sock` (RHEL & Amazon) or `/var/run/php/php-fpm.sock` (Debian) | The listen address | 20 | | `user` | `String` | The webserver user for your distro. | The user to run the FPM under | 21 | | `group` | `String` | The webserver group for your distro. | The group to run the FPM under | 22 | | `process_manager` | `String` | `dynamic` | Process manager to use - see | 23 | | `max_children` | `Integer` | `5` | Max children to scale to | 24 | | `start_servers` | `Integer` | `2` | Number of servers to start the pool with | 25 | | `min_spare_servers` | `Integer` | `1` | Minimum number of servers to have as spares | 26 | | `max_spare_servers` | `Integer` | `3` | Maximum number of servers to have as spares | 27 | | `chdir` | `String` | `/` | The startup working directory of the pool | 28 | | `additional_config` | `Hash` | `{}` | Additional parameters in JSON | 29 | | `fpm_ini_control` | `[true, false]` | `false` | Whether to add a new `php.ini` file for FPM | 30 | 31 | ## Examples 32 | 33 | 1. Install a FPM pool named 'default' 34 | 35 | ```ruby 36 | php_fpm_pool 'default' do 37 | action :install 38 | end 39 | ``` 40 | 41 | 2. Multiple FPM Pools 42 | Changes in configuration during provisioning of an FPM pool will lead to a restart of the `phpX.Y-fpm` service. 43 | If more than `5` FPM pools are affected by a configuration change, this will lead to subsequent `5+` service restarts. 44 | However, `systemd` will deny this number of subsequent service restarts with the following error: 45 | 46 | ```bash 47 | php8.1-fpm.service: Start request repeated too quickly. 48 | php8.1-fpm.service: Failed with result 'start-limit-hit'. 49 | Failed to start The PHP 8.1 FastCGI Process Manager. 50 | ``` 51 | 52 | This behavior is due to the `unified_mode true` setting of an `fpm_pool` custom resource, which is a [default setting](https://docs.chef.io/deprecations_unified_mode/) for `chef-clients v18+`. In this mode, notifications set as `:delayed` within a custom resource action (like `action :install`) are queued to be processed once the action completes (i.e., at the end of the resource `action :install` block), rather than waiting until the end of the Chef client run. 53 | 54 | **Possible Workaround** 55 | 56 | In a wrapper cookbook, define a `ruby_block` with a call to the `sleep(X)` function, which will be called upon an `fpm_pool` resource update: 57 | 58 | ```ruby 59 | # frozen_string_literal: true 60 | # 61 | # Cookbook:: my_php 62 | # Recipe:: fpm 63 | 64 | ruby_block "wait after_service restart" do 65 | block do 66 | Chef::Log.info("Waiting 5 seconds after php-fpm service restart...") 67 | sleep(5) 68 | end 69 | action :nothing 70 | end 71 | 72 | # Fancy loop on all defined pools for this node 73 | node['php']['fpm_pool'].each do |pool_name, parameters| 74 | php_fpm_pool pool_name do 75 | parameters.each do |param, value| 76 | send(param, value) 77 | end unless parameters.nil? 78 | notifies :run, "ruby_block[wait after_service restart]", :immediately 79 | end 80 | end 81 | ``` 82 | -------------------------------------------------------------------------------- /documentation/php_ini.md: -------------------------------------------------------------------------------- 1 | # `php_ini` 2 | 3 | Adds a `php.ini` to the appropriate location. 4 | 5 | ## Actions 6 | 7 | - `:add`: Add a `php.ini` file (default) 8 | - `:remove`: Remove a `php.ini` file 9 | 10 | ## Properties 11 | 12 | | Name | Type | Default | Description | 13 | | ------------------- | ---------------- | ----------------------------------------------------- | ----------------------------------------------------------- | 14 | | `conf_dir` | `String` | Platform-specific - see `libraries/helpers.rb` | Directory to place the `php.ini` file under | 15 | | `ini_template` | `String` | `php.ini.erb` (see `templates//php.ini.rb`) | Template to use to create the `php.ini` file | 16 | | `ini_cookbook` | `String` | `php` (this cookbook) | Cookbook where the template is located | 17 | | `directives` | `Hash` | `{}` | Directive-value pairs to add to the `php.ini` file | 18 | | `ext_dir` | `String` | Platform-specific - see `libraries/helpers.rb` | Directory in which the loadable extensions (modules) reside | 19 | 20 | ## Examples 21 | 22 | Add a `php.ini` file to the default location for your platform 23 | 24 | ```ruby 25 | php_ini 'ini' do 26 | action :add 27 | end 28 | ``` 29 | 30 | Add a `php.ini` file to the `/etc/php-fpm.d` directory 31 | 32 | ```ruby 33 | php_ini 'fpm.d' do 34 | conf_dir '/etc/php-fpm.d' 35 | action :add 36 | end 37 | ``` 38 | 39 | Remove a `php.ini` file from the `/etc/php-fpm.d` directory 40 | 41 | ```ruby 42 | php_ini 'fpm.d' do 43 | conf_dir '/etc/php-fpm.d' 44 | action :remove 45 | end 46 | ``` 47 | -------------------------------------------------------------------------------- /documentation/php_install.md: -------------------------------------------------------------------------------- 1 | # `php_install` 2 | 3 | By default, installs the `php` packages appropriate for your platform and adds a `php.ini` to the default location for that platform. 4 | 5 | ## Actions 6 | 7 | - `:install`: Installs PHP packages (default) 8 | 9 | ## Properties 10 | 11 | | Name | Type | Default | Description | 12 | | ------------------- | ---------------- | ----------------------------------------------------- | ----------------------------------------------------------- | 13 | | `packages` | `String` | Platform-specific - see `libraries/helpers.rb` | Packages to install | 14 | | `options` | `[String, Array]` | | Installation options (see Chef `package` resource) | 15 | | `conf_dir` | `String` | Platform-specific - see `libraries/helpers.rb` | Directory to place the `php.ini` file under | 16 | | `ini_template` | `String` | `php.ini.erb` (see `templates//php.ini.rb`) | Template to use to create the `php.ini` file | 17 | | `ini_cookbook` | `String` | `php` (this cookbook) | Cookbook where the template is located | 18 | | `directives` | `Hash` | `{}` | Directive-value pairs to add to the `php.ini` file | 19 | | `ext_dir` | `String` | Platform-specific - see `libraries/helpers.rb` | Directory in which the loadable extensions (modules) reside | 20 | 21 | ## Examples 22 | 23 | Install the default packages for your platform 24 | 25 | ```ruby 26 | php_install 'php' do 27 | action :install 28 | end 29 | ``` 30 | 31 | See [`test/cookbooks/test/recipes/community.rb`](https://github.com/sous-chefs/php/tree/main/test/cookbooks/test/recipes/community.rb) for an example for installing from a community repository. 32 | -------------------------------------------------------------------------------- /documentation/php_pear.md: -------------------------------------------------------------------------------- 1 | # `php_pear` 2 | 3 | [PEAR](http://pear.php.net/) is a framework and distribution system for reusable PHP components. [PECL](http://pecl.php.net/) is a repository for PHP Extensions. PECL contains C extensions for compiling into PHP. As C programs, PECL extensions run more efficiently than PEAR packages. PEARs and PECLs use the same packaging and distribution system. As such this resource is clever enough to abstract away the small differences and can be used for managing either. This resource also creates the proper module .ini file for each PECL extension at the correct location for each supported platform. 4 | 5 | ## Actions 6 | 7 | - `:install`: Install a pear package - if version is provided, install that specific version 8 | - `:upgrade`: Upgrade a pear package - if version is provided, upgrade to that specific version 9 | - `:remove`: Remove a pear package 10 | - `:reinstall`: Force install of the package even if the same version is already installed. Note: This will converge on every Chef run and is probably not what you want. 11 | - `:purge`: An alias for remove as the two behave the same in pear 12 | 13 | ## Properties 14 | 15 | | Name | Type | Default | Description | 16 | | ----------------- | -------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- | 17 | | `package_name` | `String` | | The name of the pear package to install | 18 | | `version` | `String` | | the version of the pear package to install/upgrade. If no version is given latest is assumed. | 19 | | `channel` | `String` | | | 20 | | `options` | `String` | | Add additional options to the underlying pear package command | 21 | | `directives` | `Hash` | `{}` | Extra extension directives (settings) for a pecl. On most platforms these usually get rendered into the extension's .ini file | 22 | | `zend_extensions` | `Array` | `[]` | PEAR by default installs stable packages only, this allows you to install pear packages in a devel, alpha or beta state | 23 | | `preferred_state` | `String` | `stable` | Package type to install | 24 | | `binary` | `String` | | The pear binary to use, by default `pear`, can be overridden if the binary is not called `pear`, e.g. `pear7` | 25 | 26 | ## Examples 27 | 28 | ```ruby 29 | # upgrade a pear 30 | php_pear 'XML_RPC' do 31 | action :upgrade 32 | end 33 | 34 | # install a specific version 35 | php_pear 'XML_RPC' do 36 | version '1.5.4' 37 | action :install 38 | end 39 | 40 | # install the mongodb pecl 41 | php_pear 'Install mongo but use a different resource name' do 42 | package_name 'mongo' 43 | action :install 44 | end 45 | 46 | # install the xdebug pecl 47 | php_pear 'xdebug' do 48 | # Specify that xdebug.so must be loaded as a zend extension 49 | zend_extensions ['xdebug.so'] 50 | action :install 51 | end 52 | 53 | # install apc pecl with directives 54 | php_pear 'apc' do 55 | action :install 56 | directives(shm_size: 128, enable_cli: 1) 57 | end 58 | 59 | # install using the pear-7 binary 60 | php_pear 'apc' do 61 | action :install 62 | binary 'pear7' 63 | end 64 | 65 | # install sync using the pecl binary 66 | php_pear 'sync' do 67 | version '1.1.1' 68 | binary 'pecl' 69 | end 70 | 71 | # install sync using the pecl channel 72 | php_pear 'sync' do 73 | version '1.1.1' 74 | channel 'pecl.php.net' 75 | end 76 | 77 | # install the beta version of Horde_Url 78 | # from the horde channel 79 | hc = php_pear_channel 'pear.horde.org' do 80 | action :discover 81 | end 82 | 83 | php_pear 'Horde_Url' do 84 | preferred_state 'beta' 85 | channel hc.channel_name 86 | action :install 87 | end 88 | 89 | # install the YAML pear from the symfony project 90 | sc = php_pear_channel 'pear.symfony-project.com' do 91 | action :discover 92 | end 93 | 94 | php_pear 'YAML' do 95 | channel sc.channel_name 96 | action :install 97 | end 98 | ``` 99 | -------------------------------------------------------------------------------- /documentation/php_pear_channel.md: -------------------------------------------------------------------------------- 1 | # `php_pear_channel` 2 | 3 | [PEAR Channels](http://pear.php.net/manual/en/guide.users.commandline.channels.php) are alternative sources for PEAR packages. This resource provides and easy way to manage these channels. 4 | 5 | ## Actions 6 | 7 | - `:discover`: Initialize a channel from its server. 8 | - `:add`: Add a channel to the channel list, usually only used to add private channels. Public channels are usually added using the `:discover` action 9 | - `:update`: Update an existing channel 10 | - `:remove`: Remove a channel from the List 11 | 12 | ## Properties 13 | 14 | | Name | Type | Default | Description | 15 | | -------------- | -------- | ------- | --------------------------------------------------- | 16 | | `channel_name` | `String` | | Name attribute. The name of the channel to discover | 17 | | `channel_xml` | `String` | | The channel.xml file of the channel you are adding | 18 | | `binary` | `String` | `pear` | Pear binary | 19 | 20 | ## Examples 21 | 22 | ```ruby 23 | # discover the horde channel 24 | php_pear_channel "pear.horde.org" do 25 | action :discover 26 | end 27 | 28 | # download xml then add the symfony channel 29 | remote_file "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" do 30 | source 'http://pear.symfony-project.com/channel.xml' 31 | mode '0644' 32 | end 33 | php_pear_channel 'symfony' do 34 | channel_xml "#{Chef::Config[:file_cache_path]}/symfony-channel.xml" 35 | action :add 36 | end 37 | 38 | # update the main pear channel 39 | php_pear_channel 'pear.php.net' do 40 | action :update 41 | end 42 | 43 | # update the main pecl channel 44 | php_pear_channel 'pecl.php.net' do 45 | action :update 46 | end 47 | ``` 48 | -------------------------------------------------------------------------------- /kitchen.dokken.yml: -------------------------------------------------------------------------------- 1 | driver: 2 | name: dokken 3 | privileged: true 4 | chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> 5 | 6 | transport: { name: dokken } 7 | provisioner: { name: dokken } 8 | 9 | platforms: 10 | - name: almalinux-8 11 | driver: 12 | image: dokken/almalinux-8 13 | pid_one_command: /usr/lib/systemd/systemd 14 | 15 | - name: almalinux-9 16 | driver: 17 | image: dokken/almalinux-9 18 | pid_one_command: /usr/lib/systemd/systemd 19 | 20 | - name: almalinux-10 21 | driver: 22 | image: dokken/almalinux-10 23 | pid_one_command: /usr/lib/systemd/systemd 24 | 25 | - name: amazonlinux-2023 26 | driver: 27 | image: dokken/amazonlinux-2023 28 | pid_one_command: /usr/lib/systemd/systemd 29 | 30 | - name: centos-stream-9 31 | driver: 32 | image: dokken/centos-stream-9 33 | pid_one_command: /usr/lib/systemd/systemd 34 | 35 | - name: centos-stream-10 36 | driver: 37 | image: dokken/centos-stream-10 38 | pid_one_command: /usr/lib/systemd/systemd 39 | 40 | - name: debian-11 41 | driver: 42 | image: dokken/debian-11 43 | pid_one_command: /bin/systemd 44 | 45 | - name: debian-12 46 | driver: 47 | image: dokken/debian-12 48 | pid_one_command: /bin/systemd 49 | 50 | - name: fedora-latest 51 | driver: 52 | image: dokken/fedora-latest 53 | pid_one_command: /usr/lib/systemd/systemd 54 | 55 | - name: opensuse-leap-15 56 | driver: 57 | image: dokken/opensuse-leap-15 58 | pid_one_command: /usr/lib/systemd/systemd 59 | 60 | - name: oraclelinux-8 61 | driver: 62 | image: dokken/oraclelinux-8 63 | pid_one_command: /usr/lib/systemd/systemd 64 | 65 | - name: oraclelinux-9 66 | driver: 67 | image: dokken/oraclelinux-9 68 | pid_one_command: /usr/lib/systemd/systemd 69 | 70 | - name: rockylinux-8 71 | driver: 72 | image: dokken/rockylinux-8 73 | pid_one_command: /usr/lib/systemd/systemd 74 | 75 | - name: rockylinux-9 76 | driver: 77 | image: dokken/rockylinux-9 78 | pid_one_command: /usr/lib/systemd/systemd 79 | 80 | - name: ubuntu-20.04 81 | driver: 82 | image: dokken/ubuntu-20.04 83 | pid_one_command: /bin/systemd 84 | 85 | - name: ubuntu-22.04 86 | driver: 87 | image: dokken/ubuntu-22.04 88 | pid_one_command: /bin/systemd 89 | 90 | - name: ubuntu-24.04 91 | driver: 92 | image: dokken/ubuntu-24.04 93 | pid_one_command: /bin/systemd 94 | -------------------------------------------------------------------------------- /kitchen.exec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: { name: exec } 3 | transport: { name: exec } 4 | 5 | platforms: 6 | - name: macos-latest 7 | - name: windows-latest 8 | -------------------------------------------------------------------------------- /kitchen.global.yml: -------------------------------------------------------------------------------- 1 | --- 2 | provisioner: 3 | name: chef_infra 4 | product_name: chef 5 | product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> 6 | channel: stable 7 | install_strategy: once 8 | chef_license: accept 9 | enforce_idempotency: <%= ENV['ENFORCE_IDEMPOTENCY'] || true %> 10 | multiple_converge: <%= ENV['MULTIPLE_CONVERGE'] || 2 %> 11 | deprecations_as_errors: true 12 | log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> 13 | 14 | verifier: 15 | name: inspec 16 | 17 | platforms: 18 | - name: almalinux-8 19 | - name: almalinux-9 20 | - name: amazonlinux-2023 21 | - name: centos-stream-9 22 | - name: debian-11 23 | - name: debian-12 24 | - name: fedora-latest 25 | - name: opensuse-leap-15 26 | - name: oraclelinux-8 27 | - name: oraclelinux-9 28 | - name: rockylinux-8 29 | - name: rockylinux-9 30 | - name: ubuntu-20.04 31 | - name: ubuntu-22.04 32 | - name: ubuntu-24.04 33 | -------------------------------------------------------------------------------- /kitchen.yml: -------------------------------------------------------------------------------- 1 | --- 2 | driver: 3 | name: vagrant 4 | 5 | provisioner: 6 | name: chef_infra 7 | product_name: chef 8 | chef_license: accept-no-persist 9 | enforce_idempotency: true 10 | multiple_converge: 2 11 | deprecations_as_errors: true 12 | 13 | verifier: 14 | name: inspec 15 | 16 | platforms: 17 | - name: almalinux-8 18 | - name: almalinux-9 19 | - name: amazonlinux-2023 20 | - name: centos-stream-9 21 | - name: debian-11 22 | - name: debian-12 23 | - name: fedora-latest 24 | - name: rockylinux-8 25 | - name: rockylinux-9 26 | - name: ubuntu-20.04 27 | - name: ubuntu-22.04 28 | - name: ubuntu-24.04 29 | 30 | suites: 31 | - name: resource 32 | run_list: 33 | - recipe[test::default] 34 | - name: resource_community 35 | run_list: 36 | - recipe[test::community] 37 | excludes: 38 | - ubuntu-18.04 39 | - amazonlinux-2023 40 | - name: resource_peclchannel 41 | run_list: 42 | - recipe[test::default] 43 | attributes: 44 | pecl_method: channel 45 | verifier: 46 | inspec_tests: 47 | - test/integration/resource 48 | -------------------------------------------------------------------------------- /libraries/helpers.rb: -------------------------------------------------------------------------------- 1 | module Php 2 | module Cookbook 3 | module Helpers 4 | def php_conf_dir 5 | if platform_family?('rhel', 'amazon', 'fedora') 6 | '/etc' 7 | else 8 | "/etc/php/#{php_version}/cli" 9 | end 10 | end 11 | 12 | def php_disable_mod 13 | '/usr/sbin/phpdismod' 14 | end 15 | 16 | def php_enable_mod 17 | '/usr/sbin/phpenmod' 18 | end 19 | 20 | def php_ext_conf_dir 21 | if platform_family?('rhel', 'amazon', 'fedora') 22 | '/etc/php.d' 23 | else 24 | "/etc/php/#{php_version}/mods-available" 25 | end 26 | end 27 | 28 | def php_ext_dir 29 | '/usr/lib64/php/modules' 30 | end 31 | 32 | def php_fpm_conf_dir 33 | if platform_family?('rhel', 'amazon', 'fedora') 34 | '/etc/php-fpm.d' 35 | else 36 | "/etc/php/#{php_version}/fpm" 37 | end 38 | end 39 | 40 | def php_fpm_default_conf 41 | if platform_family?('rhel', 'amazon', 'fedora') 42 | '/etc/php-fpm.d/www.conf' 43 | else 44 | "/etc/php/#{php_version}/fpm/pool.d/www.conf" 45 | end 46 | end 47 | 48 | def php_fpm_group 49 | if platform_family?('rhel', 'amazon', 'fedora') 50 | 'apache' 51 | else 52 | 'www-data' 53 | end 54 | end 55 | 56 | def php_fpm_listen_group 57 | if platform_family?('rhel', 'amazon', 'fedora') 58 | 'apache' 59 | else 60 | 'www-data' 61 | end 62 | end 63 | 64 | def php_fpm_listen_user 65 | if platform_family?('rhel', 'amazon', 'fedora') 66 | 'apache' 67 | else 68 | 'www-data' 69 | end 70 | end 71 | 72 | def php_fpm_package 73 | if platform_family?('rhel', 'amazon', 'fedora') 74 | 'php-fpm' 75 | else 76 | "php#{php_version}-fpm" 77 | end 78 | end 79 | 80 | def php_fpm_pool_dir 81 | if platform_family?('rhel', 'amazon', 'fedora') 82 | '/etc/php-fpm.d' 83 | else 84 | "/etc/php/#{php_version}/fpm/pool.d" 85 | end 86 | end 87 | 88 | def php_fpm_pool_template 89 | 'fpm-pool.conf.erb' 90 | end 91 | 92 | def php_fpm_service 93 | if platform_family?('rhel', 'amazon', 'fedora') 94 | 'php-fpm' 95 | else 96 | "php#{php_version}-fpm" 97 | end 98 | end 99 | 100 | def php_fpm_socket 101 | if platform_family?('rhel', 'amazon', 'fedora') 102 | "/var/run/php#{php_version}-fpm.sock" 103 | else 104 | "/var/run/php/php#{php_version}-fpm.sock" 105 | end 106 | end 107 | 108 | def php_fpm_user 109 | if platform_family?('rhel', 'amazon', 'fedora') 110 | 'apache' 111 | else 112 | 'www-data' 113 | end 114 | end 115 | 116 | def php_ini_template 117 | 'php.ini.erb' 118 | end 119 | 120 | def php_installation_packages 121 | case node['platform_family'] 122 | when 'rhel', 'fedora' 123 | %w(php php-devel php-cli php-pear) 124 | # Sometimes Amazon will default to different versions for each package, 125 | # so versions are pinned here to avoid packages getting ahead of each 126 | # other 127 | when 'amazon' 128 | ["php#{php_version}", "php#{php_version}-devel", "php#{php_version}-cli", 'php-pear'] 129 | when 'debian' 130 | case node['platform'] 131 | when 'debian' 132 | %w(php-cgi php php-dev php-cli php-pear) 133 | when 'ubuntu' 134 | ["php#{php_version}-cgi", "php#{php_version}", "php#{php_version}-dev", "php#{php_version}-cli", 'php-pear'] 135 | end 136 | end 137 | end 138 | 139 | def php_pecl 140 | 'pecl' 141 | end 142 | 143 | def php_version 144 | case node['platform_family'] 145 | when 'rhel' 146 | if node['platform_version'].to_i >= 9 147 | '8.0' 148 | else 149 | '7.2' 150 | end 151 | when 'fedora' 152 | '8.3' 153 | when 'amazon' 154 | '8.2' 155 | when 'debian' 156 | case node['platform'] 157 | when 'debian' 158 | case node['platform_version'].to_i 159 | when 10 160 | '7.3' 161 | when 11 162 | '7.4' 163 | else 164 | '8.2' # >= 12 165 | end 166 | when 'ubuntu' 167 | case node['platform_version'].to_f 168 | when 18.04 169 | '7.2' 170 | when 20.04 171 | '7.4' 172 | when 22.04 173 | '8.1' 174 | else 175 | '8.3' # >= 24.04 176 | end 177 | else 178 | '7.0' 179 | end 180 | end 181 | end 182 | end 183 | end 184 | end 185 | 186 | Chef::DSL::Recipe.include Php::Cookbook::Helpers 187 | Chef::Resource.include Php::Cookbook::Helpers 188 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'php' 2 | maintainer 'Sous Chefs' 3 | maintainer_email 'help@sous-chefs.org' 4 | license 'Apache-2.0' 5 | description 'Installs and maintains php and php modules' 6 | source_url 'https://github.com/sous-chefs/php' 7 | issues_url 'https://github.com/sous-chefs/php/issues' 8 | version '10.2.4' 9 | chef_version '>= 15.3' 10 | 11 | supports 'amazon', '>= 2.0' 12 | supports 'centos', '>= 7.0' 13 | supports 'debian', '>= 10.0' 14 | supports 'fedora', '>= 39.0' 15 | supports 'oracle', '>= 7.0' 16 | supports 'redhat', '>= 7.0' 17 | supports 'scientific', '>= 7.0' 18 | supports 'ubuntu', '>= 18.04' 19 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:base"], 4 | "packageRules": [ 5 | { 6 | "groupName": "Actions", 7 | "matchUpdateTypes": ["minor", "patch", "pin"], 8 | "automerge": true, 9 | "addLabels": ["Release: Patch", "Skip: Announcements"] 10 | }, 11 | { 12 | "groupName": "Actions", 13 | "matchUpdateTypes": ["major"], 14 | "automerge": false, 15 | "addLabels": ["Release: Patch", "Skip: Announcements"] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /resources/fpm_pool.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Chris Marchesi 3 | # Cookbook:: php 4 | # Resource:: fpm_pool 5 | # 6 | # Copyright:: 2015-2023, Chef Software, Inc 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | unified_mode true 22 | 23 | property :additional_config, Hash, default: {} 24 | property :chdir, String, default: '/' 25 | property :default_conf, String, default: lazy { php_fpm_default_conf } 26 | property :fpm_package, String, default: lazy { php_fpm_package } 27 | property :group, String, default: lazy { php_fpm_group } 28 | property :listen, String, default: lazy { php_fpm_socket } 29 | property :listen_group, String, default: lazy { php_fpm_listen_group } 30 | property :listen_user, String, default: lazy { php_fpm_listen_user } 31 | property :max_children, Integer, default: 5 32 | property :max_spare_servers, Integer, default: 3 33 | property :min_spare_servers, Integer, default: 1 34 | property :pool_cookbook, String, default: 'php' 35 | property :pool_dir, String, default: lazy { php_fpm_pool_dir } 36 | property :pool_name, String, name_property: true 37 | property :pool_template, String, default: lazy { php_fpm_pool_template } 38 | property :process_manager, String, default: 'dynamic' 39 | property :service, String, default: lazy { php_fpm_service } 40 | property :start_servers, Integer, default: 2 41 | property :user, String, default: lazy { php_fpm_user } 42 | 43 | property :fpm_ini_control, [true, false], default: false 44 | property :fpm_conf_dir, String, default: lazy { php_fpm_conf_dir } 45 | property :ini_template, String, default: lazy { php_ini_template } 46 | property :ini_cookbook, String, default: 'php' 47 | property :directives, Hash, default: {} 48 | property :ext_dir, String, default: lazy { php_ext_dir } 49 | 50 | action :install do 51 | # Ensure the FPM package is installed, and the service is registered 52 | install_fpm_package 53 | register_fpm_service 54 | 55 | if new_resource.fpm_ini_control 56 | php_ini 'fpm_ini' do 57 | conf_dir new_resource.fpm_conf_dir 58 | ini_template new_resource.ini_template 59 | ini_cookbook new_resource.ini_cookbook 60 | directives new_resource.directives 61 | ext_dir new_resource.ext_dir 62 | notifies :restart, "service[#{new_resource.service}]" 63 | not_if { new_resource.fpm_conf_dir.nil? } 64 | end 65 | end 66 | 67 | # I wanted to have this as a function in itself, but doing this seems to 68 | # break testing suites? 69 | template "#{new_resource.pool_dir}/#{new_resource.pool_name}.conf" do 70 | source new_resource.pool_template 71 | action :create 72 | cookbook new_resource.pool_cookbook 73 | variables( 74 | fpm_pool_name: new_resource.pool_name, 75 | fpm_pool_user: new_resource.user, 76 | fpm_pool_group: new_resource.group, 77 | fpm_pool_listen: new_resource.listen, 78 | fpm_pool_listen_user: new_resource.listen_user, 79 | fpm_pool_listen_group: new_resource.listen_group, 80 | fpm_pool_manager: new_resource.process_manager, 81 | fpm_pool_max_children: new_resource.max_children, 82 | fpm_pool_start_servers: new_resource.start_servers, 83 | fpm_pool_min_spare_servers: new_resource.min_spare_servers, 84 | fpm_pool_max_spare_servers: new_resource.max_spare_servers, 85 | fpm_pool_chdir: new_resource.chdir, 86 | fpm_pool_additional_config: new_resource.additional_config 87 | ) 88 | notifies :restart, "service[#{new_resource.service}]", :delayed 89 | end 90 | end 91 | 92 | action :uninstall do 93 | # Ensure the FPM package is installed, and the service is registered 94 | register_fpm_service 95 | # Delete the FPM pool. 96 | file "#{new_resource.pool_dir}/#{new_resource.pool_name}.conf" do 97 | action :delete 98 | end 99 | end 100 | 101 | action_class do 102 | def install_fpm_package 103 | # Install the FPM package for this platform, if it's available 104 | # Fail the run if it's an unsupported OS (FPM package name not populated) 105 | 106 | raise 'PHP-FPM package not found (you probably have an unsupported distro)' if new_resource.fpm_package.nil? 107 | 108 | file new_resource.default_conf do 109 | action :nothing 110 | end 111 | 112 | package new_resource.fpm_package do 113 | action :install 114 | notifies :delete, "file[#{new_resource.default_conf}]", :immediately 115 | end 116 | end 117 | 118 | def register_fpm_service 119 | service new_resource.service do 120 | action :enable 121 | end 122 | end 123 | end 124 | -------------------------------------------------------------------------------- /resources/ini.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | 3 | property :conf_dir, String, default: lazy { php_conf_dir } 4 | property :ini_template, String, default: lazy { php_ini_template } 5 | property :ini_cookbook, String, default: 'php' 6 | property :directives, Hash, default: {} 7 | property :ext_dir, String, default: lazy { php_ext_dir } 8 | 9 | action :add do 10 | template "#{new_resource.conf_dir}/php.ini" do 11 | source new_resource.ini_template 12 | cookbook new_resource.ini_cookbook 13 | owner 'root' 14 | group 'root' 15 | mode '0644' 16 | manage_symlink_source true 17 | variables( 18 | directives: new_resource.directives, 19 | php_ext_dir: new_resource.ext_dir 20 | ) 21 | end 22 | end 23 | 24 | action :remove do 25 | file "#{new_resource.conf_dir}/php.ini" do 26 | action :delete 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /resources/install.rb: -------------------------------------------------------------------------------- 1 | unified_mode true 2 | 3 | property :packages, Array, default: lazy { php_installation_packages } 4 | property :options, [ String, Array ] 5 | 6 | property :conf_dir, String, default: lazy { php_conf_dir } 7 | property :ini_template, String, default: lazy { php_ini_template } 8 | property :ini_cookbook, String, default: 'php' 9 | property :directives, Hash, default: {} 10 | property :ext_dir, String, default: lazy { php_ext_dir } 11 | 12 | action :install do 13 | package 'Install PHP Packages' do 14 | package_name new_resource.packages 15 | options new_resource.options 16 | end 17 | 18 | php_ini 'ini' do 19 | conf_dir new_resource.conf_dir 20 | ini_template new_resource.ini_template 21 | ini_cookbook new_resource.ini_cookbook 22 | directives new_resource.directives 23 | ext_dir new_resource.ext_dir 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /resources/pear.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Seth Chisamore 3 | # Cookbook:: php 4 | # Resource:: pear 5 | # 6 | # Copyright:: 2011-2021, Chef Software, Inc 7 | # 8 | # Licensed under the Apache License, Version 2.0 (the "License"); 9 | # you may not use this file except in compliance with the License. 10 | # You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | unified_mode true 22 | 23 | property :package_name, String, name_property: true 24 | property :version, [String, nil] 25 | property :channel, String 26 | property :options, String 27 | property :directives, Hash, default: {} 28 | property :zend_extensions, Array, default: [] 29 | property :preferred_state, String, default: 'stable' 30 | property :binary, String, default: 'pear' 31 | property :priority, [String, nil] 32 | property :enable_mod, String, default: lazy { php_enable_mod } 33 | property :disable_mod, String, default: lazy { php_disable_mod } 34 | property :pecl, String, default: lazy { php_pecl } 35 | property :conf_dir, String, default: lazy { php_conf_dir } 36 | property :ext_conf_dir, String, default: lazy { php_ext_conf_dir } 37 | 38 | def current_installed_version(new_resource) 39 | version_check_cmd = "#{new_resource.binary} -d" 40 | version_check_cmd << " preferred_state=#{new_resource.preferred_state}" 41 | version_check_cmd << " list#{expand_channel(new_resource.channel)}" 42 | p = shell_out(version_check_cmd) 43 | response = nil 44 | response = grep_for_version(p.stdout, new_resource.package_name) if p.stdout =~ /\.?Installed packages/i 45 | response 46 | end 47 | 48 | def expand_channel(channel) 49 | channel ? " -c #{channel}" : '' 50 | end 51 | 52 | def grep_for_version(stdout, package) 53 | version = nil 54 | stdout.split(/\n/).grep(/^#{package}\s/i).each do |m| 55 | # XML_RPC 1.5.4 stable 56 | # mongo 1.1.4/(1.1.4 stable) 1.1.4 MongoDB database driver 57 | # Horde_Url -n/a-/(1.0.0beta1 beta) Horde Url class 58 | # Horde_Url 1.0.0beta1 (beta) 1.0.0beta1 Horde Url class 59 | version = m.split(/\s+/)[1].strip 60 | version = if version.split(%r{///})[0] =~ /.\./ 61 | # 1.1.4/(1.1.4 stable) 62 | version.split(%r{///})[0] 63 | else 64 | # -n/a-/(1.0.0beta1 beta) 65 | version.split(%r{/(.*)/\((.*)/}).last.split(/\s/)[0] 66 | end 67 | end 68 | version 69 | end 70 | 71 | load_current_value do |new_resource| 72 | unless current_installed_version(new_resource).nil? 73 | version(current_installed_version(new_resource)) 74 | Chef::Log.debug("Current version is #{version}") if version 75 | end 76 | end 77 | 78 | action :install do 79 | build_essential 80 | 81 | # If we specified a version, and it's not the current version, move to the specified version 82 | unless new_resource.version.nil? || new_resource.version == current_resource.version 83 | install_version = new_resource.version 84 | end 85 | # Check if the version we want is already installed 86 | versions_match = candidate_version == current_installed_version(new_resource) 87 | 88 | # If it's not installed at all or an upgrade, install it 89 | if install_version || new_resource.version.nil? && !versions_match 90 | converge_by("install package #{new_resource.package_name} #{install_version}") do 91 | info_output = "Installing #{new_resource.package_name}" 92 | info_output << " version #{install_version}" if install_version && !install_version.empty? 93 | Chef::Log.info(info_output) 94 | install_package(new_resource.package_name, install_version) 95 | end 96 | end 97 | end 98 | 99 | # reinstall is just an install that always fires 100 | action :reinstall do 101 | build_essential 102 | 103 | install_version = new_resource.version unless new_resource.version.nil? 104 | converge_by("reinstall package #{new_resource.package_name} #{install_version}") do 105 | info_output = "Installing #{new_resource.package_name}" 106 | info_output << " version #{install_version}" if install_version && !install_version.empty? 107 | Chef::Log.info(info_output) 108 | install_package(new_resource.package_name, install_version, force: true) 109 | end 110 | end 111 | 112 | action :upgrade do 113 | if current_resource.version != candidate_version 114 | orig_version = @current_resource.version || 'uninstalled' 115 | description = "upgrade package #{new_resource.package_name} version from #{orig_version} to #{candidate_version}" 116 | converge_by(description) do 117 | upgrade_package(new_resource.package_name, candidate_version) 118 | end 119 | end 120 | end 121 | 122 | action :remove do 123 | if removing_package? 124 | converge_by("remove package #{new_resource.package_name}") do 125 | remove_package(@current_resource.package_name, new_resource.version) 126 | end 127 | end 128 | end 129 | 130 | action :purge do 131 | if removing_package? 132 | converge_by("purge package #{new_resource.package_name}") do 133 | remove_package(@current_resource.package_name, new_resource.version) 134 | end 135 | end 136 | end 137 | 138 | action_class do 139 | def expand_options(options) 140 | options ? " #{options}" : '' 141 | end 142 | 143 | def candidate_version 144 | base_url = "https://#{new_resource.channel || new_resource.binary + '.php.net'}/" 145 | package_version_url = "/rest/r/#{new_resource.package_name.downcase}/allreleases.xml" 146 | # url = "https://#{new_resource.channel || new_resource.binary + '.php.net'}/rest/r/#{new_resource.package_name.downcase}/allreleases.xml" 147 | versions_response = Chef::HTTP.new(base_url).get(package_version_url) 148 | 149 | require 'nokogiri' 150 | doc = Nokogiri::XML(versions_response) 151 | doc.remove_namespaces! 152 | rows = doc.xpath('//r') 153 | rows.each do |r| 154 | next unless r.at_xpath('.//s').content == new_resource.preferred_state 155 | break r.at_xpath('.//v').content 156 | end 157 | end 158 | 159 | def install_package(name, version, **opts) 160 | command = "printf \"\r\" | #{new_resource.binary} -d" 161 | command << " preferred_state=#{new_resource.preferred_state}" 162 | command << " install -a#{expand_options(new_resource.options)}" 163 | command << ' -f' if opts[:force] # allows us to force a reinstall 164 | command << " #{prefix_channel(new_resource.channel)}#{name}" 165 | command << "-#{version}" if version && !version.empty? 166 | pear_shell_out(command) 167 | if pecl? 168 | manage_pecl_ini(name, :create, new_resource.directives, new_resource.zend_extensions, 169 | new_resource.priority) 170 | end 171 | enable_package(name) 172 | end 173 | 174 | def upgrade_package(name, version) 175 | command = "printf \"\r\" | #{new_resource.binary} -d" 176 | command << " preferred_state=#{new_resource.preferred_state}" 177 | command << " upgrade -a#{expand_options(new_resource.options)}" 178 | command << " #{prefix_channel(new_resource.channel)}#{name}" 179 | command << "-#{version}" if version && !version.empty? 180 | pear_shell_out(command) 181 | if pecl? 182 | manage_pecl_ini(name, :create, new_resource.directives, new_resource.zend_extensions, 183 | new_resource.priority) 184 | end 185 | enable_package(name) 186 | end 187 | 188 | def remove_package(name, version) 189 | command = "#{new_resource.binary} uninstall" 190 | command << " #{expand_options(new_resource.options)}" 191 | command << " #{prefix_channel(new_resource.channel)}#{name}" 192 | command << "-#{version}" if version && !version.empty? 193 | pear_shell_out(command) 194 | disable_package(name) 195 | manage_pecl_ini(name, :delete, nil, nil, nil) if pecl? 196 | end 197 | 198 | def enable_package(name) 199 | execute "#{new_resource.enable_mod} #{name}" do 200 | only_if { platform?('ubuntu') && ::File.exist?(new_resource.enable_mod) } 201 | end 202 | end 203 | 204 | def disable_package(name) 205 | execute "#{new_resource.disable_mod} #{name}" do 206 | only_if { platform?('ubuntu') && ::File.exist?(new_resource.disable_mod) } 207 | end 208 | end 209 | 210 | def pear_shell_out(command) 211 | p = shell_out!(command) 212 | # pear/pecl commands return a 0 on failures...we'll grep for it 213 | p.invalid! if p.stdout.split('\n').last =~ /^ERROR:.+/i 214 | p 215 | end 216 | 217 | def prefix_channel(channel) 218 | channel ? "#{channel}/" : '' 219 | end 220 | 221 | def removing_package? 222 | if new_resource.version.nil? 223 | true # remove any version of a package 224 | else 225 | new_resource.version == @current_resource.version # we don't have the version we want to remove 226 | end 227 | end 228 | 229 | def extension_dir 230 | @extension_dir ||= begin 231 | # Consider using "pecl config-get ext_dir". It is more cross-platform. 232 | # p = shell_out("php-config --extension-dir") 233 | p = shell_out("#{new_resource.pecl} config-get ext_dir") 234 | p.stdout.strip 235 | end 236 | end 237 | 238 | def get_extension_files(name) 239 | files = [] 240 | 241 | # use appropriate binary when listing pecl packages 242 | list_binary = if new_resource.channel == 'pecl.php.net' 243 | new_resource.pecl 244 | else 245 | new_resource.binary 246 | end 247 | 248 | p = shell_out("#{list_binary} list-files #{name}") 249 | p.stdout.each_line.grep(/^(src|ext)\s+.*\.so$/i).each do |line| 250 | files << line.split[1] 251 | end 252 | 253 | files 254 | end 255 | 256 | def pecl? 257 | @pecl ||= 258 | begin 259 | # search as a pear first since most 3rd party channels will report pears as pecls! 260 | search_args = '' 261 | search_args << " -d preferred_state=#{new_resource.preferred_state}" 262 | search_args << " search#{expand_channel(new_resource.channel)} #{new_resource.package_name}" 263 | 264 | if grep_for_version(shell_out(new_resource.binary + search_args).stdout, new_resource.package_name) 265 | if (new_resource.binary.include? 'pecl') || (new_resource.channel == 'pecl.php.net') 266 | true 267 | else 268 | false 269 | end 270 | elsif grep_for_version(shell_out(new_resource.pecl + search_args).stdout, new_resource.package_name) 271 | true 272 | else 273 | raise "Package #{new_resource.package_name} not found in either PEAR or PECL." 274 | end 275 | end 276 | end 277 | 278 | def manage_pecl_ini(name, action, directives, zend_extensions, priority) 279 | ext_prefix = extension_dir 280 | ext_prefix << ::File::SEPARATOR if ext_prefix[-1].chr != ::File::SEPARATOR 281 | 282 | files = get_extension_files(name) 283 | 284 | extensions = Hash[ 285 | files.map do |filepath| 286 | rel_file = filepath.clone 287 | rel_file.slice! ext_prefix if rel_file.start_with? ext_prefix 288 | zend = zend_extensions.include?(rel_file) 289 | [(zend ? filepath : rel_file), zend] 290 | end 291 | ] 292 | 293 | directory new_resource.ext_conf_dir do 294 | owner 'root' 295 | group 'root' 296 | mode '0755' 297 | recursive true 298 | end 299 | 300 | template "#{new_resource.ext_conf_dir}/#{name}.ini" do 301 | source 'extension.ini.erb' 302 | cookbook 'php' 303 | owner 'root' 304 | group 'root' 305 | mode '0644' 306 | variables( 307 | name: name, 308 | extensions: extensions, 309 | directives: directives, 310 | priority: priority 311 | ) 312 | action action 313 | end 314 | 315 | execute "#{new_resource.enable_mod} #{name}" do 316 | creates "#{new_resource.conf_dir}/conf.d/#{name}" 317 | only_if { platform_family? 'debian' } 318 | end 319 | end 320 | end 321 | -------------------------------------------------------------------------------- /resources/pear_channel.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Author:: Seth Chisamore 3 | # Author:: Jennifer Davis 4 | # Cookbook:: php 5 | # Resource:: pear_channel 6 | # 7 | # Copyright:: 2011-2021, Chef Software, Inc 8 | # 9 | # Licensed under the Apache License, Version 2.0 (the "License"); 10 | # you may not use this file except in compliance with the License. 11 | # You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, software 16 | # distributed under the License is distributed on an "AS IS" BASIS, 17 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | # See the License for the specific language governing permissions and 19 | # limitations under the License. 20 | # 21 | 22 | unified_mode true 23 | 24 | property :channel_xml, String 25 | property :channel_name, String, name_property: true 26 | property :binary, String, default: 'pear' 27 | 28 | action :discover do 29 | unless exists? 30 | Chef::Log.info("Discovering pear channel #{new_resource}") 31 | execute "#{new_resource.binary} channel-discover #{new_resource.channel_name}" 32 | end 33 | end 34 | 35 | action :add do 36 | unless exists? 37 | Chef::Log.info("Adding pear channel #{new_resource} from #{new_resource.channel_xml}") 38 | execute "#{new_resource.binary} channel-add #{new_resource.channel_xml}" 39 | end 40 | end 41 | 42 | action :update do 43 | if exists? && update_needed? 44 | converge_by("update pear channel #{new_resource}") do 45 | Chef::Log.info("Updating pear channel #{new_resource}") 46 | shell_out!("#{new_resource.binary} channel-update #{new_resource.channel_name}") 47 | end 48 | end 49 | end 50 | 51 | action :remove do 52 | if exists? 53 | Chef::Log.info("Deleting pear channel #{new_resource}") 54 | execute "#{new_resource.binary} channel-delete #{new_resource.channel_name}" 55 | end 56 | end 57 | 58 | action_class do 59 | # determine if the channel needs to be updated by searching for a bogus package 60 | # in that channel and looking for the text prompting the user to update the channel 61 | # in the CLI output 62 | # @return [Boolean] does the channel need to be updated 63 | def update_needed? 64 | begin 65 | if shell_out("#{new_resource.binary} search -c #{new_resource.channel_name} NNNNNN").stdout =~ /channel-update/ 66 | return true 67 | end 68 | rescue Chef::Exceptions::CommandTimeout 69 | # CentOS can hang on 'pear search' if a channel needs updating 70 | Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{new_resource.channel_name}") 71 | return true 72 | end 73 | false 74 | end 75 | 76 | # run pear channel-info to see if the channel has been setup or not 77 | # @return [Boolean] does the channel exist locally 78 | def exists? 79 | shell_out!("#{new_resource.binary} channel-info #{new_resource.channel_name}") 80 | true 81 | rescue Mixlib::ShellOut::ShellCommandFailed 82 | false 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /spec/libraries/helpers_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | require_relative '../../libraries/helpers' 3 | 4 | RSpec.describe Php::Cookbook::Helpers do 5 | class DummyClass < Chef::Node 6 | include Php::Cookbook::Helpers 7 | end 8 | 9 | subject { DummyClass.new } 10 | 11 | describe '#php_version' do 12 | before do 13 | allow(subject).to receive(:[]).with('platform_family').and_return(platform_family) 14 | allow(subject).to receive(:[]).with('platform').and_return(platform) 15 | allow(subject).to receive(:[]).with('platform_version').and_return(platform_version) 16 | end 17 | 18 | context 'rhel' do 19 | let(:platform_family) { 'rhel' } 20 | let(:platform) { nil } 21 | let(:platform_version) { nil } 22 | it { expect(subject.php_version).to eq '7.2' } 23 | end 24 | 25 | context 'amazon' do 26 | let(:platform_family) { 'amazon' } 27 | let(:platform) { nil } 28 | let(:platform_version) { nil } 29 | it { expect(subject.php_version).to eq '8.2' } 30 | end 31 | 32 | context 'debian' do 33 | let(:platform_family) { 'debian' } 34 | 35 | context 'debian 10' do 36 | let(:platform) { 'debian' } 37 | let(:platform_version) { '10' } 38 | it { expect(subject.php_version).to eq '7.3' } 39 | end 40 | 41 | context 'debian 11' do 42 | let(:platform) { 'debian' } 43 | let(:platform_version) { '11' } 44 | it { expect(subject.php_version).to eq '7.4' } 45 | end 46 | 47 | context 'ubuntu 18.04' do 48 | let(:platform) { 'ubuntu' } 49 | let(:platform_version) { '18.04' } 50 | it { expect(subject.php_version).to eq '7.2' } 51 | end 52 | 53 | context 'ubuntu 20.04' do 54 | let(:platform) { 'ubuntu' } 55 | let(:platform_version) { '20.04' } 56 | it { expect(subject.php_version).to eq '7.4' } 57 | end 58 | 59 | context 'ubuntu 22.04' do 60 | let(:platform) { 'ubuntu' } 61 | let(:platform_version) { '22.04' } 62 | it { expect(subject.php_version).to eq '8.1' } 63 | end 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'chefspec' 2 | require 'chefspec/berkshelf' 3 | 4 | RSpec.configure do |config| 5 | config.color = true # Use color in STDOUT 6 | config.formatter = :documentation # Use the specified formatter 7 | config.log_level = :error # Avoid deprecation notice SPAM 8 | end 9 | -------------------------------------------------------------------------------- /templates/centos/php.ini.erb: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | ;;;;;;;;;;;;;;;;;;; 4 | ; About php.ini ; 5 | ;;;;;;;;;;;;;;;;;;; 6 | ; This file controls many aspects of PHP's behavior. In order for PHP to 7 | ; read it, it must be named 'php.ini'. PHP looks for it in the current 8 | ; working directory, in the path designated by the environment variable 9 | ; PHPRC, and in the path that was defined in compile time (in that order). 10 | ; Under Windows, the compile-time path is the Windows directory. The 11 | ; path in which the php.ini file is looked for can be overridden using 12 | ; the -c argument in command line mode. 13 | ; 14 | ; The syntax of the file is extremely simple. Whitespace and Lines 15 | ; beginning with a semicolon are silently ignored (as you probably guessed). 16 | ; Section headers (e.g. [Foo]) are also silently ignored, even though 17 | ; they might mean something in the future. 18 | ; 19 | ; Directives are specified using the following syntax: 20 | ; directive = value 21 | ; Directive names are *case sensitive* - foo=bar is different from FOO=bar. 22 | ; 23 | ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one 24 | ; of the INI constants (On, Off, True, False, Yes, No and None) or an expression 25 | ; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo"). 26 | ; 27 | ; Expressions in the INI file are limited to bitwise operators and parentheses: 28 | ; | bitwise OR 29 | ; & bitwise AND 30 | ; ~ bitwise NOT 31 | ; ! boolean NOT 32 | ; 33 | ; Boolean flags can be turned on using the values 1, On, True or Yes. 34 | ; They can be turned off using the values 0, Off, False or No. 35 | ; 36 | ; An empty string can be denoted by simply not writing anything after the equal 37 | ; sign, or by using the None keyword: 38 | ; 39 | ; foo = ; sets foo to an empty string 40 | ; foo = none ; sets foo to an empty string 41 | ; foo = "none" ; sets foo to the string 'none' 42 | ; 43 | ; If you use constants in your value, and these constants belong to a 44 | ; dynamically loaded extension (either a PHP extension or a Zend extension), 45 | ; you may only use these constants *after* the line that loads the extension. 46 | ; 47 | ; 48 | ;;;;;;;;;;;;;;;;;;; 49 | ; About this file ; 50 | ;;;;;;;;;;;;;;;;;;; 51 | ; This is the recommended, PHP 5-style version of the php.ini-dist file. It 52 | ; sets some non standard settings, that make PHP more efficient, more secure, 53 | ; and encourage cleaner coding. 54 | ; 55 | ; The price is that with these settings, PHP may be incompatible with some 56 | ; applications, and sometimes, more difficult to develop with. Using this 57 | ; file is warmly recommended for production sites. As all of the changes from 58 | ; the standard settings are thoroughly documented, you can go over each one, 59 | ; and decide whether you want to use it or not. 60 | ; 61 | ; For general information about the php.ini file, please consult the php.ini-dist 62 | ; file, included in your PHP distribution. 63 | ; 64 | ; This file is different from the php.ini-dist file in the fact that it features 65 | ; different values for several directives, in order to improve performance, while 66 | ; possibly breaking compatibility with the standard out-of-the-box behavior of 67 | ; PHP. Please make sure you read what's different, and modify your scripts 68 | ; accordingly, if you decide to use this file instead. 69 | ; 70 | ; - register_globals = Off [Security, Performance] 71 | ; Global variables are no longer registered for input data (POST, GET, cookies, 72 | ; environment and other server variables). Instead of using $foo, you must use 73 | ; you can use $_REQUEST["foo"] (includes any variable that arrives through the 74 | ; request, namely, POST, GET and cookie variables), or use one of the specific 75 | ; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"], depending 76 | ; on where the input originates. Also, you can look at the 77 | ; import_request_variables() function. 78 | ; Note that register_globals is going to be depracated (i.e., turned off by 79 | ; default) in the next version of PHP, because it often leads to security bugs. 80 | ; Read http://php.net/manual/en/security.registerglobals.php for further 81 | ; information. 82 | ; - register_long_arrays = Off [Performance] 83 | ; Disables registration of the older (and deprecated) long predefined array 84 | ; variables ($HTTP_*_VARS). Instead, use the superglobals that were 85 | ; introduced in PHP 4.1.0 86 | ; - display_errors = Off [Security] 87 | ; With this directive set to off, errors that occur during the execution of 88 | ; scripts will no longer be displayed as a part of the script output, and thus, 89 | ; will no longer be exposed to remote users. With some errors, the error message 90 | ; content may expose information about your script, web server, or database 91 | ; server that may be exploitable for hacking. Production sites should have this 92 | ; directive set to off. 93 | ; - log_errors = On [Security] 94 | ; This directive complements the above one. Any errors that occur during the 95 | ; execution of your script will be logged (typically, to your server's error log, 96 | ; but can be configured in several ways). Along with setting display_errors to off, 97 | ; this setup gives you the ability to fully understand what may have gone wrong, 98 | ; without exposing any sensitive information to remote users. 99 | ; - output_buffering = 4096 [Performance] 100 | ; Set a 4KB output buffer. Enabling output buffering typically results in less 101 | ; writes, and sometimes less packets sent on the wire, which can often lead to 102 | ; better performance. The gain this directive actually yields greatly depends 103 | ; on which Web server you're working with, and what kind of scripts you're using. 104 | ; - register_argc_argv = Off [Performance] 105 | ; Disables registration of the somewhat redundant $argv and $argc global 106 | ; variables. 107 | ; - magic_quotes_gpc = Off [Performance] 108 | ; Input data is no longer escaped with slashes so that it can be sent into 109 | ; SQL databases without further manipulation. Instead, you should use the 110 | ; function addslashes() on each input element you wish to send to a database. 111 | ; - variables_order = "GPCS" [Performance] 112 | ; The environment variables are not hashed into the $_ENV. To access 113 | ; environment variables, you can use getenv() instead. 114 | ; - error_reporting = E_ALL [Code Cleanliness, Security(?)] 115 | ; By default, PHP surpresses errors of type E_NOTICE. These error messages 116 | ; are emitted for non-critical errors, but that could be a symptom of a bigger 117 | ; problem. Most notably, this will cause error messages about the use 118 | ; of uninitialized variables to be displayed. 119 | ; - allow_call_time_pass_reference = Off [Code cleanliness] 120 | ; It's not possible to decide to force a variable to be passed by reference 121 | ; when calling a function. The PHP 4 style to do this is by making the 122 | ; function require the relevant argument by reference. 123 | 124 | 125 | ;;;;;;;;;;;;;;;;;;;; 126 | ; Language Options ; 127 | ;;;;;;;;;;;;;;;;;;;; 128 | 129 | ; Enable the PHP scripting language engine under Apache. 130 | engine = On 131 | 132 | ; Enable compatibility mode with Zend Engine 1 (PHP 4.x) 133 | zend.ze1_compatibility_mode = Off 134 | 135 | ; Allow the tags are recognized. 136 | ; NOTE: Using short tags should be avoided when developing applications or 137 | ; libraries that are meant for redistribution, or deployment on PHP 138 | ; servers which are not under your control, because short tags may not 139 | ; be supported on the target server. For portable, redistributable code, 140 | ; be sure not to use short tags. 141 | short_open_tag = On 142 | 143 | ; Allow ASP-style <% %> tags. 144 | asp_tags = Off 145 | 146 | ; The number of significant digits displayed in floating point numbers. 147 | precision = 14 148 | 149 | ; Enforce year 2000 compliance (will cause problems with non-compliant browsers) 150 | y2k_compliance = On 151 | 152 | ; Output buffering allows you to send header lines (including cookies) even 153 | ; after you send body content, at the price of slowing PHP's output layer a 154 | ; bit. You can enable output buffering during runtime by calling the output 155 | ; buffering functions. You can also enable output buffering for all files by 156 | ; setting this directive to On. If you wish to limit the size of the buffer 157 | ; to a certain size - you can use a maximum number of bytes instead of 'On', as 158 | ; a value for this directive (e.g., output_buffering=4096). 159 | output_buffering = 4096 160 | 161 | ; You can redirect all of the output of your scripts to a function. For 162 | ; example, if you set output_handler to "mb_output_handler", character 163 | ; encoding will be transparently converted to the specified encoding. 164 | ; Setting any output handler automatically turns on output buffering. 165 | ; Note: People who wrote portable scripts should not depend on this ini 166 | ; directive. Instead, explicitly set the output handler using ob_start(). 167 | ; Using this ini directive may cause problems unless you know what script 168 | ; is doing. 169 | ; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" 170 | ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". 171 | ; Note: output_handler must be empty if this is set 'On' !!!! 172 | ; Instead you must use zlib.output_handler. 173 | ;output_handler = 174 | 175 | ; Transparent output compression using the zlib library 176 | ; Valid values for this option are 'off', 'on', or a specific buffer size 177 | ; to be used for compression (default is 4KB) 178 | ; Note: Resulting chunk size may vary due to nature of compression. PHP 179 | ; outputs chunks that are few hundreds bytes each as a result of 180 | ; compression. If you prefer a larger chunk size for better 181 | ; performance, enable output_buffering in addition. 182 | ; Note: You need to use zlib.output_handler instead of the standard 183 | ; output_handler, or otherwise the output will be corrupted. 184 | zlib.output_compression = Off 185 | 186 | ; You cannot specify additional output handlers if zlib.output_compression 187 | ; is activated here. This setting does the same as output_handler but in 188 | ; a different order. 189 | ;zlib.output_handler = 190 | 191 | ; Implicit flush tells PHP to tell the output layer to flush itself 192 | ; automatically after every output block. This is equivalent to calling the 193 | ; PHP function flush() after each and every call to print() or echo() and each 194 | ; and every HTML block. Turning this option on has serious performance 195 | ; implications and is generally recommended for debugging purposes only. 196 | implicit_flush = Off 197 | 198 | ; The unserialize callback function will be called (with the undefined class' 199 | ; name as parameter), if the unserializer finds an undefined class 200 | ; which should be instantiated. 201 | ; A warning appears if the specified function is not defined, or if the 202 | ; function doesn't include/implement the missing class. 203 | ; So only set this entry, if you really want to implement such a 204 | ; callback-function. 205 | unserialize_callback_func= 206 | 207 | ; When floats & doubles are serialized store serialize_precision significant 208 | ; digits after the floating point. The default value ensures that when floats 209 | ; are decoded with unserialize, the data will remain the same. 210 | serialize_precision = 100 211 | 212 | ; Whether to enable the ability to force arguments to be passed by reference 213 | ; at function call time. This method is deprecated and is likely to be 214 | ; unsupported in future versions of PHP/Zend. The encouraged method of 215 | ; specifying which arguments should be passed by reference is in the function 216 | ; declaration. You're encouraged to try and turn this option Off and make 217 | ; sure your scripts work properly with it in order to ensure they will work 218 | ; with future versions of the language (you will receive a warning each time 219 | ; you use this feature, and the argument will be passed by value instead of by 220 | ; reference). 221 | allow_call_time_pass_reference = Off 222 | 223 | ; 224 | ; Safe Mode 225 | ; 226 | safe_mode = Off 227 | 228 | ; By default, Safe Mode does a UID compare check when 229 | ; opening files. If you want to relax this to a GID compare, 230 | ; then turn on safe_mode_gid. 231 | safe_mode_gid = Off 232 | 233 | ; When safe_mode is on, UID/GID checks are bypassed when 234 | ; including files from this directory and its subdirectories. 235 | ; (directory must also be in include_path or full path must 236 | ; be used when including) 237 | safe_mode_include_dir = 238 | 239 | ; When safe_mode is on, only executables located in the safe_mode_exec_dir 240 | ; will be allowed to be executed via the exec family of functions. 241 | safe_mode_exec_dir = 242 | 243 | ; Setting certain environment variables may be a potential security breach. 244 | ; This directive contains a comma-delimited list of prefixes. In Safe Mode, 245 | ; the user may only alter environment variables whose names begin with the 246 | ; prefixes supplied here. By default, users will only be able to set 247 | ; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). 248 | ; 249 | ; Note: If this directive is empty, PHP will let the user modify ANY 250 | ; environment variable! 251 | safe_mode_allowed_env_vars = PHP_ 252 | 253 | ; This directive contains a comma-delimited list of environment variables that 254 | ; the end user won't be able to change using putenv(). These variables will be 255 | ; protected even if safe_mode_allowed_env_vars is set to allow to change them. 256 | safe_mode_protected_env_vars = LD_LIBRARY_PATH 257 | 258 | ; open_basedir, if set, limits all file operations to the defined directory 259 | ; and below. This directive makes most sense if used in a per-directory 260 | ; or per-virtualhost web server configuration file. This directive is 261 | ; *NOT* affected by whether Safe Mode is turned On or Off. 262 | ;open_basedir = 263 | 264 | ; This directive allows you to disable certain functions for security reasons. 265 | ; It receives a comma-delimited list of function names. This directive is 266 | ; *NOT* affected by whether Safe Mode is turned On or Off. 267 | disable_functions = 268 | 269 | ; This directive allows you to disable certain classes for security reasons. 270 | ; It receives a comma-delimited list of class names. This directive is 271 | ; *NOT* affected by whether Safe Mode is turned On or Off. 272 | disable_classes = 273 | 274 | ; Colors for Syntax Highlighting mode. Anything that's acceptable in 275 | ; would work. 276 | ;highlight.string = #DD0000 277 | ;highlight.comment = #FF9900 278 | ;highlight.keyword = #007700 279 | ;highlight.bg = #FFFFFF 280 | ;highlight.default = #0000BB 281 | ;highlight.html = #000000 282 | 283 | ; If enabled, the request will be allowed to complete even if the user aborts 284 | ; the request. Consider enabling it if executing long request, which may end up 285 | ; being interrupted by the user or a browser timing out. 286 | ; ignore_user_abort = On 287 | 288 | ; Determines the size of the realpath cache to be used by PHP. This value should 289 | ; be increased on systems where PHP opens many files to reflect the quantity of 290 | ; the file operations performed. 291 | ; realpath_cache_size=16k 292 | 293 | ; Duration of time, in seconds for which to cache realpath information for a given 294 | ; file or directory. For systems with rarely changing files, consider increasing this 295 | ; value. 296 | ; realpath_cache_ttl=120 297 | 298 | ; 299 | ; Misc 300 | ; 301 | ; Decides whether PHP may expose the fact that it is installed on the server 302 | ; (e.g. by adding its signature to the Web server header). It is no security 303 | ; threat in any way, but it makes it possible to determine whether you use PHP 304 | ; on your server or not. 305 | expose_php = On 306 | 307 | 308 | ;;;;;;;;;;;;;;;;;;; 309 | ; Resource Limits ; 310 | ;;;;;;;;;;;;;;;;;;; 311 | 312 | max_execution_time = 30 ; Maximum execution time of each script, in seconds 313 | max_input_time = 60 ; Maximum amount of time each script may spend parsing request data 314 | memory_limit = 128M ; Maximum amount of memory a script may consume 315 | 316 | 317 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 318 | ; Error handling and logging ; 319 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 320 | 321 | ; error_reporting is a bit-field. Or each number up to get desired error 322 | ; reporting level 323 | ; E_ALL - All errors and warnings (doesn't include E_STRICT) 324 | ; E_ERROR - fatal run-time errors 325 | ; E_WARNING - run-time warnings (non-fatal errors) 326 | ; E_PARSE - compile-time parse errors 327 | ; E_NOTICE - run-time notices (these are warnings which often result 328 | ; from a bug in your code, but it's possible that it was 329 | ; intentional (e.g., using an uninitialized variable and 330 | ; relying on the fact it's automatically initialized to an 331 | ; empty string) 332 | ; E_STRICT - run-time notices, enable to have PHP suggest changes 333 | ; to your code which will ensure the best interoperability 334 | ; and forward compatibility of your code 335 | ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup 336 | ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's 337 | ; initial startup 338 | ; E_COMPILE_ERROR - fatal compile-time errors 339 | ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) 340 | ; E_USER_ERROR - user-generated error message 341 | ; E_USER_WARNING - user-generated warning message 342 | ; E_USER_NOTICE - user-generated notice message 343 | ; 344 | ; Examples: 345 | ; 346 | ; - Show all errors, except for notices and coding standards warnings 347 | ; 348 | ;error_reporting = E_ALL & ~E_NOTICE 349 | ; 350 | ; - Show all errors, except for notices 351 | ; 352 | ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT 353 | ; 354 | ; - Show only errors 355 | ; 356 | ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR 357 | ; 358 | ; - Show all errors, except coding standards warnings 359 | ; 360 | error_reporting = E_ALL 361 | 362 | ; Print out errors (as a part of the output). For production web sites, 363 | ; you're strongly encouraged to turn this feature off, and use error logging 364 | ; instead (see below). Keeping display_errors enabled on a production web site 365 | ; may reveal security information to end users, such as file paths on your Web 366 | ; server, your database schema or other information. 367 | display_errors = Off 368 | 369 | ; Even when display_errors is on, errors that occur during PHP's startup 370 | ; sequence are not displayed. It's strongly recommended to keep 371 | ; display_startup_errors off, except for when debugging. 372 | display_startup_errors = Off 373 | 374 | ; Log errors into a log file (server-specific log, stderr, or error_log (below)) 375 | ; As stated above, you're strongly advised to use error logging in place of 376 | ; error displaying on production web sites. 377 | log_errors = On 378 | 379 | ; Set maximum length of log_errors. In error_log information about the source is 380 | ; added. The default is 1024 and 0 allows to not apply any maximum length at all. 381 | log_errors_max_len = 1024 382 | 383 | ; Do not log repeated messages. Repeated errors must occur in same file on same 384 | ; line until ignore_repeated_source is set true. 385 | ignore_repeated_errors = Off 386 | 387 | ; Ignore source of message when ignoring repeated messages. When this setting 388 | ; is On you will not log errors with repeated messages from different files or 389 | ; sourcelines. 390 | ignore_repeated_source = Off 391 | 392 | ; If this parameter is set to Off, then memory leaks will not be shown (on 393 | ; stdout or in the log). This has only effect in a debug compile, and if 394 | ; error reporting includes E_WARNING in the allowed list 395 | report_memleaks = On 396 | 397 | ; Store the last error/warning message in $php_errormsg (boolean). 398 | track_errors = Off 399 | 400 | ; Disable the inclusion of HTML tags in error messages. 401 | ; Note: Never use this feature for production boxes. 402 | ;html_errors = Off 403 | 404 | ; If html_errors is set On PHP produces clickable error messages that direct 405 | ; to a page describing the error or function causing the error in detail. 406 | ; You can download a copy of the PHP manual from http://www.php.net/docs.php 407 | ; and change docref_root to the base URL of your local copy including the 408 | ; leading '/'. You must also specify the file extension being used including 409 | ; the dot. 410 | ; Note: Never use this feature for production boxes. 411 | ;docref_root = "/phpmanual/" 412 | ;docref_ext = .html 413 | 414 | ; String to output before an error message. 415 | ;error_prepend_string = "" 416 | 417 | ; String to output after an error message. 418 | ;error_append_string = "" 419 | 420 | ; Log errors to specified file. 421 | ;error_log = filename 422 | 423 | ; Log errors to syslog (Event Log on NT, not valid in Windows 95). 424 | ;error_log = syslog 425 | 426 | 427 | ;;;;;;;;;;;;;;;;; 428 | ; Data Handling ; 429 | ;;;;;;;;;;;;;;;;; 430 | ; 431 | ; Note - track_vars is ALWAYS enabled as of PHP 4.0.3 432 | 433 | ; The separator used in PHP generated URLs to separate arguments. 434 | ; Default is "&". 435 | ;arg_separator.output = "&" 436 | 437 | ; List of separator(s) used by PHP to parse input URLs into variables. 438 | ; Default is "&". 439 | ; NOTE: Every character in this directive is considered as separator! 440 | ;arg_separator.input = ";&" 441 | 442 | ; This directive describes the order in which PHP registers GET, POST, Cookie, 443 | ; Environment and Built-in variables (G, P, C, E & S respectively, often 444 | ; referred to as EGPCS or GPC). Registration is done from left to right, newer 445 | ; values override older values. 446 | variables_order = "EGPCS" 447 | 448 | ; Whether or not to register the EGPCS variables as global variables. You may 449 | ; want to turn this off if you don't want to clutter your scripts' global scope 450 | ; with user data. This makes most sense when coupled with track_vars - in which 451 | ; case you can access all of the GPC variables through the $HTTP_*_VARS[], 452 | ; variables. 453 | ; 454 | ; You should do your best to write your scripts so that they do not require 455 | ; register_globals to be on; Using form variables as globals can easily lead 456 | ; to possible security problems, if the code is not very well thought of. 457 | register_globals = Off 458 | 459 | ; Whether or not to register the old-style input arrays, HTTP_GET_VARS 460 | ; and friends. If you're not using them, it's recommended to turn them off, 461 | ; for performance reasons. 462 | register_long_arrays = Off 463 | 464 | ; This directive tells PHP whether to declare the argv&argc variables (that 465 | ; would contain the GET information). If you don't use these variables, you 466 | ; should turn it off for increased performance. 467 | register_argc_argv = Off 468 | 469 | ; When enabled, the SERVER and ENV variables are created when they're first 470 | ; used (Just In Time) instead of when the script starts. If these variables 471 | ; are not used within a script, having this directive on will result in a 472 | ; performance gain. The PHP directives register_globals, register_long_arrays, 473 | ; and register_argc_argv must be disabled for this directive to have any affect. 474 | auto_globals_jit = On 475 | 476 | ; Maximum size of POST data that PHP will accept. 477 | post_max_size = 8M 478 | 479 | ; Magic quotes 480 | ; 481 | 482 | ; Magic quotes for incoming GET/POST/Cookie data. 483 | magic_quotes_gpc = Off 484 | 485 | ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. 486 | magic_quotes_runtime = Off 487 | 488 | ; Use Sybase-style magic quotes (escape ' with '' instead of \'). 489 | magic_quotes_sybase = Off 490 | 491 | ; Automatically add files before or after any PHP document. 492 | auto_prepend_file = 493 | auto_append_file = 494 | 495 | ; As of 4.0b4, PHP always outputs a character encoding by default in 496 | ; the Content-type: header. To disable sending of the charset, simply 497 | ; set it to be empty. 498 | ; 499 | ; PHP's built-in default is text/html 500 | default_mimetype = "text/html" 501 | ;default_charset = "iso-8859-1" 502 | 503 | ; Always populate the $HTTP_RAW_POST_DATA variable. 504 | ;always_populate_raw_post_data = On 505 | 506 | 507 | ;;;;;;;;;;;;;;;;;;;;;;;;; 508 | ; Paths and Directories ; 509 | ;;;;;;;;;;;;;;;;;;;;;;;;; 510 | 511 | ; UNIX: "/path1:/path2" 512 | ;include_path = ".:/php/includes" 513 | ; 514 | ; Windows: "\path1;\path2" 515 | ;include_path = ".;c:\php\includes" 516 | 517 | ; The root of the PHP pages, used only if nonempty. 518 | ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root 519 | ; if you are running php as a CGI under any web server (other than IIS) 520 | ; see documentation for security issues. The alternate is to use the 521 | ; cgi.force_redirect configuration below 522 | doc_root = 523 | 524 | ; The directory under which PHP opens the script using /~username used only 525 | ; if nonempty. 526 | user_dir = 527 | 528 | ; Directory in which the loadable extensions (modules) reside. 529 | extension_dir = "<%= @php_ext_dir %>" 530 | 531 | ; Whether or not to enable the dl() function. The dl() function does NOT work 532 | ; properly in multithreaded servers, such as IIS or Zeus, and is automatically 533 | ; disabled on them. 534 | enable_dl = On 535 | 536 | ; cgi.force_redirect is necessary to provide security running PHP as a CGI under 537 | ; most web servers. Left undefined, PHP turns this on by default. You can 538 | ; turn it off here AT YOUR OWN RISK 539 | ; **You CAN safely turn this off for IIS, in fact, you MUST.** 540 | ; cgi.force_redirect = 1 541 | 542 | ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with 543 | ; every request. 544 | ; cgi.nph = 1 545 | 546 | ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape 547 | ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP 548 | ; will look for to know it is OK to continue execution. Setting this variable MAY 549 | ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. 550 | ; cgi.redirect_status_env = ; 551 | 552 | ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate 553 | ; security tokens of the calling client. This allows IIS to define the 554 | ; security context that the request runs under. mod_fastcgi under Apache 555 | ; does not currently support this feature (03/17/2002) 556 | ; Set to 1 if running under IIS. Default is zero. 557 | ; fastcgi.impersonate = 1; 558 | 559 | ; Disable logging through FastCGI connection 560 | ; fastcgi.log = 0 561 | 562 | ; cgi.rfc2616_headers configuration option tells PHP what type of headers to 563 | ; use when sending HTTP response code. If it's set 0 PHP sends Status: header that 564 | ; is supported by Apache. When this option is set to 1 PHP will send 565 | ; RFC2616 compliant header. 566 | ; Default is zero. 567 | ;cgi.rfc2616_headers = 0 568 | 569 | 570 | ;;;;;;;;;;;;;;;; 571 | ; File Uploads ; 572 | ;;;;;;;;;;;;;;;; 573 | 574 | ; Whether to allow HTTP file uploads. 575 | file_uploads = On 576 | 577 | ; Temporary directory for HTTP uploaded files (will use system default if not 578 | ; specified). 579 | ;upload_tmp_dir = 580 | 581 | ; Maximum allowed size for uploaded files. 582 | upload_max_filesize = 2M 583 | 584 | 585 | ;;;;;;;;;;;;;;;;;; 586 | ; Fopen wrappers ; 587 | ;;;;;;;;;;;;;;;;;; 588 | 589 | ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. 590 | allow_url_fopen = On 591 | 592 | ; Define the anonymous ftp password (your email address) 593 | ;from="john@doe.com" 594 | 595 | ; Define the User-Agent string 596 | ; user_agent="PHP" 597 | 598 | ; Default timeout for socket based streams (seconds) 599 | default_socket_timeout = 60 600 | 601 | ; If your scripts have to deal with files from Macintosh systems, 602 | ; or you are running on a Mac and need to deal with files from 603 | ; unix or win32 systems, setting this flag will cause PHP to 604 | ; automatically detect the EOL character in those files so that 605 | ; fgets() and file() will work regardless of the source of the file. 606 | ; auto_detect_line_endings = Off 607 | 608 | 609 | ;;;;;;;;;;;;;;;;;;;;;; 610 | ; Dynamic Extensions ; 611 | ;;;;;;;;;;;;;;;;;;;;;; 612 | ; 613 | ; If you wish to have an extension loaded automatically, use the following 614 | ; syntax: 615 | ; 616 | ; extension=modulename.extension 617 | ; 618 | ; For example: 619 | ; 620 | ; extension=msql.so 621 | ; 622 | ; Note that it should be the name of the module only; no directory information 623 | ; needs to go here. Specify the location of the extension with the 624 | ; extension_dir directive above. 625 | 626 | 627 | ;;;; 628 | ; Note: packaged extension modules are now loaded via the .ini files 629 | ; found in the directory /etc/php.d; these are loaded by default. 630 | ;;;; 631 | 632 | 633 | ;;;;;;;;;;;;;;;;;;; 634 | ; Module Settings ; 635 | ;;;;;;;;;;;;;;;;;;; 636 | 637 | [Date] 638 | ; Defines the default timezone used by the date functions 639 | ;date.timezone = 640 | 641 | [Syslog] 642 | ; Whether or not to define the various syslog variables (e.g. $LOG_PID, 643 | ; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In 644 | ; runtime, you can define these variables by calling define_syslog_variables(). 645 | define_syslog_variables = Off 646 | 647 | [mail function] 648 | ; For Win32 only. 649 | SMTP = localhost 650 | smtp_port = 25 651 | 652 | ; For Win32 only. 653 | ;sendmail_from = me@example.com 654 | 655 | ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). 656 | sendmail_path = /usr/sbin/sendmail -t -i 657 | 658 | ; Force the addition of the specified parameters to be passed as extra parameters 659 | ; to the sendmail binary. These parameters will always replace the value of 660 | ; the 5th parameter to mail(), even in safe mode. 661 | ;mail.force_extra_parameters = 662 | 663 | [SQL] 664 | sql.safe_mode = Off 665 | 666 | [ODBC] 667 | ;odbc.default_db = Not yet implemented 668 | ;odbc.default_user = Not yet implemented 669 | ;odbc.default_pw = Not yet implemented 670 | 671 | ; Allow or prevent persistent links. 672 | odbc.allow_persistent = On 673 | 674 | ; Check that a connection is still valid before reuse. 675 | odbc.check_persistent = On 676 | 677 | ; Maximum number of persistent links. -1 means no limit. 678 | odbc.max_persistent = -1 679 | 680 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 681 | odbc.max_links = -1 682 | 683 | ; Handling of LONG fields. Returns number of bytes to variables. 0 means 684 | ; passthru. 685 | odbc.defaultlrl = 4096 686 | 687 | ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. 688 | ; See the documentation on odbc_binmode and odbc_longreadlen for an explanation 689 | ; of uodbc.defaultlrl and uodbc.defaultbinmode 690 | odbc.defaultbinmode = 1 691 | 692 | [MySQL] 693 | ; Allow or prevent persistent links. 694 | mysql.allow_persistent = On 695 | 696 | ; Maximum number of persistent links. -1 means no limit. 697 | mysql.max_persistent = -1 698 | 699 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 700 | mysql.max_links = -1 701 | 702 | ; Default port number for mysql_connect(). If unset, mysql_connect() will use 703 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 704 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 705 | ; at MYSQL_PORT. 706 | mysql.default_port = 707 | 708 | ; Default socket name for local MySQL connects. If empty, uses the built-in 709 | ; MySQL defaults. 710 | mysql.default_socket = 711 | 712 | ; Default host for mysql_connect() (doesn't apply in safe mode). 713 | mysql.default_host = 714 | 715 | ; Default user for mysql_connect() (doesn't apply in safe mode). 716 | mysql.default_user = 717 | 718 | ; Default password for mysql_connect() (doesn't apply in safe mode). 719 | ; Note that this is generally a *bad* idea to store passwords in this file. 720 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") 721 | ; and reveal this password! And of course, any users with read access to this 722 | ; file will be able to reveal the password as well. 723 | mysql.default_password = 724 | 725 | ; Maximum time (in secondes) for connect timeout. -1 means no limit 726 | mysql.connect_timeout = 60 727 | 728 | ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and 729 | ; SQL-Errors will be displayed. 730 | mysql.trace_mode = Off 731 | 732 | [MySQLi] 733 | 734 | ; Maximum number of links. -1 means no limit. 735 | mysqli.max_links = -1 736 | 737 | ; Default port number for mysqli_connect(). If unset, mysqli_connect() will use 738 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 739 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 740 | ; at MYSQL_PORT. 741 | mysqli.default_port = 3306 742 | 743 | ; Default socket name for local MySQL connects. If empty, uses the built-in 744 | ; MySQL defaults. 745 | mysqli.default_socket = 746 | 747 | ; Default host for mysql_connect() (doesn't apply in safe mode). 748 | mysqli.default_host = 749 | 750 | ; Default user for mysql_connect() (doesn't apply in safe mode). 751 | mysqli.default_user = 752 | 753 | ; Default password for mysqli_connect() (doesn't apply in safe mode). 754 | ; Note that this is generally a *bad* idea to store passwords in this file. 755 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") 756 | ; and reveal this password! And of course, any users with read access to this 757 | ; file will be able to reveal the password as well. 758 | mysqli.default_pw = 759 | 760 | ; Allow or prevent reconnect 761 | mysqli.reconnect = Off 762 | 763 | [mSQL] 764 | ; Allow or prevent persistent links. 765 | msql.allow_persistent = On 766 | 767 | ; Maximum number of persistent links. -1 means no limit. 768 | msql.max_persistent = -1 769 | 770 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 771 | msql.max_links = -1 772 | 773 | [PostgresSQL] 774 | ; Allow or prevent persistent links. 775 | pgsql.allow_persistent = On 776 | 777 | ; Detect broken persistent links always with pg_pconnect(). 778 | ; Auto reset feature requires a little overheads. 779 | pgsql.auto_reset_persistent = Off 780 | 781 | ; Maximum number of persistent links. -1 means no limit. 782 | pgsql.max_persistent = -1 783 | 784 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 785 | pgsql.max_links = -1 786 | 787 | ; Ignore PostgreSQL backends Notice message or not. 788 | ; Notice message logging require a little overheads. 789 | pgsql.ignore_notice = 0 790 | 791 | ; Log PostgreSQL backends Noitce message or not. 792 | ; Unless pgsql.ignore_notice=0, module cannot log notice message. 793 | pgsql.log_notice = 0 794 | 795 | [Sybase] 796 | ; Allow or prevent persistent links. 797 | sybase.allow_persistent = On 798 | 799 | ; Maximum number of persistent links. -1 means no limit. 800 | sybase.max_persistent = -1 801 | 802 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 803 | sybase.max_links = -1 804 | 805 | ;sybase.interface_file = "/usr/sybase/interfaces" 806 | 807 | ; Minimum error severity to display. 808 | sybase.min_error_severity = 10 809 | 810 | ; Minimum message severity to display. 811 | sybase.min_message_severity = 10 812 | 813 | ; Compatability mode with old versions of PHP 3.0. 814 | ; If on, this will cause PHP to automatically assign types to results according 815 | ; to their Sybase type, instead of treating them all as strings. This 816 | ; compatability mode will probably not stay around forever, so try applying 817 | ; whatever necessary changes to your code, and turn it off. 818 | sybase.compatability_mode = Off 819 | 820 | [Sybase-CT] 821 | ; Allow or prevent persistent links. 822 | sybct.allow_persistent = On 823 | 824 | ; Maximum number of persistent links. -1 means no limit. 825 | sybct.max_persistent = -1 826 | 827 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 828 | sybct.max_links = -1 829 | 830 | ; Minimum server message severity to display. 831 | sybct.min_server_severity = 10 832 | 833 | ; Minimum client message severity to display. 834 | sybct.min_client_severity = 10 835 | 836 | [bcmath] 837 | ; Number of decimal digits for all bcmath functions. 838 | bcmath.scale = 0 839 | 840 | [browscap] 841 | ;browscap = extra/browscap.ini 842 | 843 | [Informix] 844 | ; Default host for ifx_connect() (doesn't apply in safe mode). 845 | ifx.default_host = 846 | 847 | ; Default user for ifx_connect() (doesn't apply in safe mode). 848 | ifx.default_user = 849 | 850 | ; Default password for ifx_connect() (doesn't apply in safe mode). 851 | ifx.default_password = 852 | 853 | ; Allow or prevent persistent links. 854 | ifx.allow_persistent = On 855 | 856 | ; Maximum number of persistent links. -1 means no limit. 857 | ifx.max_persistent = -1 858 | 859 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 860 | ifx.max_links = -1 861 | 862 | ; If on, select statements return the contents of a text blob instead of its id. 863 | ifx.textasvarchar = 0 864 | 865 | ; If on, select statements return the contents of a byte blob instead of its id. 866 | ifx.byteasvarchar = 0 867 | 868 | ; Trailing blanks are stripped from fixed-length char columns. May help the 869 | ; life of Informix SE users. 870 | ifx.charasvarchar = 0 871 | 872 | ; If on, the contents of text and byte blobs are dumped to a file instead of 873 | ; keeping them in memory. 874 | ifx.blobinfile = 0 875 | 876 | ; NULL's are returned as empty strings, unless this is set to 1. In that case, 877 | ; NULL's are returned as string 'NULL'. 878 | ifx.nullformat = 0 879 | 880 | [Session] 881 | ; Handler used to store/retrieve data. 882 | session.save_handler = files 883 | 884 | ; Argument passed to save_handler. In the case of files, this is the path 885 | ; where data files are stored. Note: Windows users have to change this 886 | ; variable in order to use PHP's session functions. 887 | ; 888 | ; As of PHP 4.0.1, you can define the path as: 889 | ; 890 | ; session.save_path = "N;/path" 891 | ; 892 | ; where N is an integer. Instead of storing all the session files in 893 | ; /path, what this will do is use subdirectories N-levels deep, and 894 | ; store the session data in those directories. This is useful if you 895 | ; or your OS have problems with lots of files in one directory, and is 896 | ; a more efficient layout for servers that handle lots of sessions. 897 | ; 898 | ; NOTE 1: PHP will not create this directory structure automatically. 899 | ; You can use the script in the ext/session dir for that purpose. 900 | ; NOTE 2: See the section on garbage collection below if you choose to 901 | ; use subdirectories for session storage 902 | ; 903 | ; The file storage module creates files using mode 600 by default. 904 | ; You can change that by using 905 | ; 906 | ; session.save_path = "N;MODE;/path" 907 | ; 908 | ; where MODE is the octal representation of the mode. Note that this 909 | ; does not overwrite the process's umask. 910 | session.save_path = "/var/lib/php/session" 911 | 912 | ; Whether to use cookies. 913 | session.use_cookies = 1 914 | 915 | ; This option enables administrators to make their users invulnerable to 916 | ; attacks which involve passing session ids in URLs; defaults to 0. 917 | ; session.use_only_cookies = 1 918 | 919 | ; Name of the session (used as cookie name). 920 | session.name = PHPSESSID 921 | 922 | ; Initialize session on request startup. 923 | session.auto_start = 0 924 | 925 | ; Lifetime in seconds of cookie or, if 0, until browser is restarted. 926 | session.cookie_lifetime = 0 927 | 928 | ; The path for which the cookie is valid. 929 | session.cookie_path = / 930 | 931 | ; The domain for which the cookie is valid. 932 | session.cookie_domain = 933 | 934 | ; Handler used to serialize data. php is the standard serializer of PHP. 935 | session.serialize_handler = php 936 | 937 | ; Define the probability that the 'garbage collection' process is started 938 | ; on every session initialization. 939 | ; The probability is calculated by using gc_probability/gc_divisor, 940 | ; e.g. 1/100 means there is a 1% chance that the GC process starts 941 | ; on each request. 942 | 943 | session.gc_probability = 1 944 | session.gc_divisor = 1000 945 | 946 | ; After this number of seconds, stored data will be seen as 'garbage' and 947 | ; cleaned up by the garbage collection process. 948 | session.gc_maxlifetime = 1440 949 | 950 | ; NOTE: If you are using the subdirectory option for storing session files 951 | ; (see session.save_path above), then garbage collection does *not* 952 | ; happen automatically. You will need to do your own garbage 953 | ; collection through a shell script, cron entry, or some other method. 954 | ; For example, the following script would is the equivalent of 955 | ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): 956 | ; cd /path/to/sessions; find -cmin +24 | xargs rm 957 | 958 | ; PHP 4.2 and less have an undocumented feature/bug that allows you to 959 | ; to initialize a session variable in the global scope, albeit register_globals 960 | ; is disabled. PHP 4.3 and later will warn you, if this feature is used. 961 | ; You can disable the feature and the warning separately. At this time, 962 | ; the warning is only displayed, if bug_compat_42 is enabled. 963 | 964 | session.bug_compat_42 = 0 965 | session.bug_compat_warn = 1 966 | 967 | ; Check HTTP Referer to invalidate externally stored URLs containing ids. 968 | ; HTTP_REFERER has to contain this substring for the session to be 969 | ; considered as valid. 970 | session.referer_check = 971 | 972 | ; How many bytes to read from the file. 973 | session.entropy_length = 0 974 | 975 | ; Specified here to create the session id. 976 | session.entropy_file = 977 | 978 | ;session.entropy_length = 16 979 | 980 | ;session.entropy_file = /dev/urandom 981 | 982 | ; Set to {nocache,private,public,} to determine HTTP caching aspects 983 | ; or leave this empty to avoid sending anti-caching headers. 984 | session.cache_limiter = nocache 985 | 986 | ; Document expires after n minutes. 987 | session.cache_expire = 180 988 | 989 | ; trans sid support is disabled by default. 990 | ; Use of trans sid may risk your users security. 991 | ; Use this option with caution. 992 | ; - User may send URL contains active session ID 993 | ; to other person via. email/irc/etc. 994 | ; - URL that contains active session ID may be stored 995 | ; in publically accessible computer. 996 | ; - User may access your site with the same session ID 997 | ; always using URL stored in browser's history or bookmarks. 998 | session.use_trans_sid = 0 999 | 1000 | ; Select a hash function 1001 | ; 0: MD5 (128 bits) 1002 | ; 1: SHA-1 (160 bits) 1003 | session.hash_function = 0 1004 | 1005 | ; Define how many bits are stored in each character when converting 1006 | ; the binary hash data to something readable. 1007 | ; 1008 | ; 4 bits: 0-9, a-f 1009 | ; 5 bits: 0-9, a-v 1010 | ; 6 bits: 0-9, a-z, A-Z, "-", "," 1011 | session.hash_bits_per_character = 5 1012 | 1013 | ; The URL rewriter will look for URLs in a defined set of HTML tags. 1014 | ; form/fieldset are special; if you include them here, the rewriter will 1015 | ; add a hidden field with the info which is otherwise appended 1016 | ; to URLs. If you want XHTML conformity, remove the form entry. 1017 | ; Note that all valid entries require a "=", even if no value follows. 1018 | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" 1019 | 1020 | [MSSQL] 1021 | ; Allow or prevent persistent links. 1022 | mssql.allow_persistent = On 1023 | 1024 | ; Maximum number of persistent links. -1 means no limit. 1025 | mssql.max_persistent = -1 1026 | 1027 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 1028 | mssql.max_links = -1 1029 | 1030 | ; Minimum error severity to display. 1031 | mssql.min_error_severity = 10 1032 | 1033 | ; Minimum message severity to display. 1034 | mssql.min_message_severity = 10 1035 | 1036 | ; Compatability mode with old versions of PHP 3.0. 1037 | mssql.compatability_mode = Off 1038 | 1039 | ; Connect timeout 1040 | ;mssql.connect_timeout = 5 1041 | 1042 | ; Query timeout 1043 | ;mssql.timeout = 60 1044 | 1045 | ; Valid range 0 - 2147483647. Default = 4096. 1046 | ;mssql.textlimit = 4096 1047 | 1048 | ; Valid range 0 - 2147483647. Default = 4096. 1049 | ;mssql.textsize = 4096 1050 | 1051 | ; Limits the number of records in each batch. 0 = all records in one batch. 1052 | ;mssql.batchsize = 0 1053 | 1054 | ; Specify how datetime and datetim4 columns are returned 1055 | ; On => Returns data converted to SQL server settings 1056 | ; Off => Returns values as YYYY-MM-DD hh:mm:ss 1057 | ;mssql.datetimeconvert = On 1058 | 1059 | ; Use NT authentication when connecting to the server 1060 | mssql.secure_connection = Off 1061 | 1062 | ; Specify max number of processes. -1 = library default 1063 | ; msdlib defaults to 25 1064 | ; FreeTDS defaults to 4096 1065 | ;mssql.max_procs = -1 1066 | 1067 | ; Specify client character set. 1068 | ; If empty or not set the client charset from freetds.comf is used 1069 | ; This is only used when compiled with FreeTDS 1070 | ;mssql.charset = "ISO-8859-1" 1071 | 1072 | [Assertion] 1073 | ; Assert(expr); active by default. 1074 | ;assert.active = On 1075 | 1076 | ; Issue a PHP warning for each failed assertion. 1077 | ;assert.warning = On 1078 | 1079 | ; Don't bail out by default. 1080 | ;assert.bail = Off 1081 | 1082 | ; User-function to be called if an assertion fails. 1083 | ;assert.callback = 0 1084 | 1085 | ; Eval the expression with current error_reporting(). Set to true if you want 1086 | ; error_reporting(0) around the eval(). 1087 | ;assert.quiet_eval = 0 1088 | 1089 | [Verisign Payflow Pro] 1090 | ; Default Payflow Pro server. 1091 | pfpro.defaulthost = "test-payflow.verisign.com" 1092 | 1093 | ; Default port to connect to. 1094 | pfpro.defaultport = 443 1095 | 1096 | ; Default timeout in seconds. 1097 | pfpro.defaulttimeout = 30 1098 | 1099 | ; Default proxy IP address (if required). 1100 | ;pfpro.proxyaddress = 1101 | 1102 | ; Default proxy port. 1103 | ;pfpro.proxyport = 1104 | 1105 | ; Default proxy logon. 1106 | ;pfpro.proxylogon = 1107 | 1108 | ; Default proxy password. 1109 | ;pfpro.proxypassword = 1110 | 1111 | [COM] 1112 | ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs 1113 | ;com.typelib_file = 1114 | ; allow Distributed-COM calls 1115 | ;com.allow_dcom = true 1116 | ; autoregister constants of a components typlib on com_load() 1117 | ;com.autoregister_typelib = true 1118 | ; register constants casesensitive 1119 | ;com.autoregister_casesensitive = false 1120 | ; show warnings on duplicate constat registrations 1121 | ;com.autoregister_verbose = true 1122 | 1123 | [mbstring] 1124 | ; language for internal character representation. 1125 | ;mbstring.language = Japanese 1126 | 1127 | ; internal/script encoding. 1128 | ; Some encoding cannot work as internal encoding. 1129 | ; (e.g. SJIS, BIG5, ISO-2022-*) 1130 | ;mbstring.internal_encoding = EUC-JP 1131 | 1132 | ; http input encoding. 1133 | ;mbstring.http_input = auto 1134 | 1135 | ; http output encoding. mb_output_handler must be 1136 | ; registered as output buffer to function 1137 | ;mbstring.http_output = SJIS 1138 | 1139 | ; enable automatic encoding translation according to 1140 | ; mbstring.internal_encoding setting. Input chars are 1141 | ; converted to internal encoding by setting this to On. 1142 | ; Note: Do _not_ use automatic encoding translation for 1143 | ; portable libs/applications. 1144 | ;mbstring.encoding_translation = Off 1145 | 1146 | ; automatic encoding detection order. 1147 | ; auto means 1148 | ;mbstring.detect_order = auto 1149 | 1150 | ; substitute_character used when character cannot be converted 1151 | ; one from another 1152 | ;mbstring.substitute_character = none; 1153 | 1154 | ; overload(replace) single byte functions by mbstring functions. 1155 | ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), 1156 | ; etc. Possible values are 0,1,2,4 or combination of them. 1157 | ; For example, 7 for overload everything. 1158 | ; 0: No overload 1159 | ; 1: Overload mail() function 1160 | ; 2: Overload str*() functions 1161 | ; 4: Overload ereg*() functions 1162 | ;mbstring.func_overload = 0 1163 | 1164 | ; enable strict encoding detection. 1165 | ;mbstring.strict_encoding = Off 1166 | 1167 | [FrontBase] 1168 | ;fbsql.allow_persistent = On 1169 | ;fbsql.autocommit = On 1170 | ;fbsql.default_database = 1171 | ;fbsql.default_database_password = 1172 | ;fbsql.default_host = 1173 | ;fbsql.default_password = 1174 | ;fbsql.default_user = "_SYSTEM" 1175 | ;fbsql.generate_warnings = Off 1176 | ;fbsql.max_connections = 128 1177 | ;fbsql.max_links = 128 1178 | ;fbsql.max_persistent = -1 1179 | ;fbsql.max_results = 128 1180 | ;fbsql.batchSize = 1000 1181 | 1182 | [gd] 1183 | ; Tell the jpeg decode to libjpeg warnings and try to create 1184 | ; a gd image. The warning will then be displayed as notices 1185 | ; disabled by default 1186 | ;gd.jpeg_ignore_warning = 0 1187 | 1188 | [exif] 1189 | ; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. 1190 | ; With mbstring support this will automatically be converted into the encoding 1191 | ; given by corresponding encode setting. When empty mbstring.internal_encoding 1192 | ; is used. For the decode settings you can distinguish between motorola and 1193 | ; intel byte order. A decode setting cannot be empty. 1194 | ;exif.encode_unicode = ISO-8859-15 1195 | ;exif.decode_unicode_motorola = UCS-2BE 1196 | ;exif.decode_unicode_intel = UCS-2LE 1197 | ;exif.encode_jis = 1198 | ;exif.decode_jis_motorola = JIS 1199 | ;exif.decode_jis_intel = JIS 1200 | 1201 | [Tidy] 1202 | ; The path to a default tidy configuration file to use when using tidy 1203 | ;tidy.default_config = /usr/local/lib/php/default.tcfg 1204 | 1205 | ; Should tidy clean and repair output automatically? 1206 | ; WARNING: Do not use this option if you are generating non-html content 1207 | ; such as dynamic images 1208 | tidy.clean_output = Off 1209 | 1210 | [soap] 1211 | ; Enables or disables WSDL caching feature. 1212 | soap.wsdl_cache_enabled=1 1213 | ; Sets the directory name where SOAP extension will put cache files. 1214 | soap.wsdl_cache_dir="/tmp" 1215 | ; (time to live) Sets the number of second while cached file will be used 1216 | ; instead of original one. 1217 | soap.wsdl_cache_ttl=86400 1218 | 1219 | ; Local Variables: 1220 | ; tab-width: 4 1221 | ; End: 1222 | 1223 | <% @directives.sort_by { |key, val| key }.each do |directive, value| -%> 1224 | <%= "#{directive}=#{value}" %> 1225 | <% end -%> 1226 | -------------------------------------------------------------------------------- /templates/default/extension.ini.erb: -------------------------------------------------------------------------------- 1 | ; configuration for php <%= @name %> module 2 | <% if @priority %> 3 | ; priority=<%= @priority %> 4 | <% end -%> 5 | <% @extensions.each do |filepath, zend| -%> 6 | <%= 'zend_' if zend %>extension=<%= filepath %> 7 | <% end -%> 8 | <% @directives.each do |k,v| -%> 9 | <%= "#{@name}.#{k}=#{v}" %> 10 | <% end -%> 11 | -------------------------------------------------------------------------------- /templates/default/fpm-pool.conf.erb: -------------------------------------------------------------------------------- 1 | [<%= @fpm_pool_name %>] 2 | user = <%= @fpm_pool_user %> 3 | group = <%= @fpm_pool_group %> 4 | listen = <%= @fpm_pool_listen %> 5 | listen.owner = <%= @fpm_pool_listen_user %> 6 | listen.group = <%= @fpm_pool_listen_group %> 7 | pm = <%= @fpm_pool_manager %> 8 | pm.max_children = <%= @fpm_pool_max_children %> 9 | pm.start_servers = <%= @fpm_pool_start_servers %> 10 | pm.min_spare_servers = <%= @fpm_pool_min_spare_servers %> 11 | pm.max_spare_servers = <%= @fpm_pool_max_spare_servers %> 12 | chdir = <%= @fpm_pool_chdir %> 13 | <% @fpm_pool_additional_config.each do |key, value| %> 14 | <%= key %> = <%= value %> 15 | <% end %> 16 | -------------------------------------------------------------------------------- /templates/redhat/php.ini.erb: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | ;;;;;;;;;;;;;;;;;;; 4 | ; About php.ini ; 5 | ;;;;;;;;;;;;;;;;;;; 6 | ; This file controls many aspects of PHP's behavior. In order for PHP to 7 | ; read it, it must be named 'php.ini'. PHP looks for it in the current 8 | ; working directory, in the path designated by the environment variable 9 | ; PHPRC, and in the path that was defined in compile time (in that order). 10 | ; Under Windows, the compile-time path is the Windows directory. The 11 | ; path in which the php.ini file is looked for can be overridden using 12 | ; the -c argument in command line mode. 13 | ; 14 | ; The syntax of the file is extremely simple. Whitespace and Lines 15 | ; beginning with a semicolon are silently ignored (as you probably guessed). 16 | ; Section headers (e.g. [Foo]) are also silently ignored, even though 17 | ; they might mean something in the future. 18 | ; 19 | ; Directives are specified using the following syntax: 20 | ; directive = value 21 | ; Directive names are *case sensitive* - foo=bar is different from FOO=bar. 22 | ; 23 | ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one 24 | ; of the INI constants (On, Off, True, False, Yes, No and None) or an expression 25 | ; (e.g. E_ALL & ~E_NOTICE), or a quoted string ("foo"). 26 | ; 27 | ; Expressions in the INI file are limited to bitwise operators and parentheses: 28 | ; | bitwise OR 29 | ; & bitwise AND 30 | ; ~ bitwise NOT 31 | ; ! boolean NOT 32 | ; 33 | ; Boolean flags can be turned on using the values 1, On, True or Yes. 34 | ; They can be turned off using the values 0, Off, False or No. 35 | ; 36 | ; An empty string can be denoted by simply not writing anything after the equal 37 | ; sign, or by using the None keyword: 38 | ; 39 | ; foo = ; sets foo to an empty string 40 | ; foo = none ; sets foo to an empty string 41 | ; foo = "none" ; sets foo to the string 'none' 42 | ; 43 | ; If you use constants in your value, and these constants belong to a 44 | ; dynamically loaded extension (either a PHP extension or a Zend extension), 45 | ; you may only use these constants *after* the line that loads the extension. 46 | ; 47 | ; 48 | ;;;;;;;;;;;;;;;;;;; 49 | ; About this file ; 50 | ;;;;;;;;;;;;;;;;;;; 51 | ; This is the recommended, PHP 5-style version of the php.ini-dist file. It 52 | ; sets some non standard settings, that make PHP more efficient, more secure, 53 | ; and encourage cleaner coding. 54 | ; 55 | ; The price is that with these settings, PHP may be incompatible with some 56 | ; applications, and sometimes, more difficult to develop with. Using this 57 | ; file is warmly recommended for production sites. As all of the changes from 58 | ; the standard settings are thoroughly documented, you can go over each one, 59 | ; and decide whether you want to use it or not. 60 | ; 61 | ; For general information about the php.ini file, please consult the php.ini-dist 62 | ; file, included in your PHP distribution. 63 | ; 64 | ; This file is different from the php.ini-dist file in the fact that it features 65 | ; different values for several directives, in order to improve performance, while 66 | ; possibly breaking compatibility with the standard out-of-the-box behavior of 67 | ; PHP. Please make sure you read what's different, and modify your scripts 68 | ; accordingly, if you decide to use this file instead. 69 | ; 70 | ; - register_globals = Off [Security, Performance] 71 | ; Global variables are no longer registered for input data (POST, GET, cookies, 72 | ; environment and other server variables). Instead of using $foo, you must use 73 | ; you can use $_REQUEST["foo"] (includes any variable that arrives through the 74 | ; request, namely, POST, GET and cookie variables), or use one of the specific 75 | ; $_GET["foo"], $_POST["foo"], $_COOKIE["foo"] or $_FILES["foo"], depending 76 | ; on where the input originates. Also, you can look at the 77 | ; import_request_variables() function. 78 | ; Note that register_globals is going to be depracated (i.e., turned off by 79 | ; default) in the next version of PHP, because it often leads to security bugs. 80 | ; Read http://php.net/manual/en/security.registerglobals.php for further 81 | ; information. 82 | ; - register_long_arrays = Off [Performance] 83 | ; Disables registration of the older (and deprecated) long predefined array 84 | ; variables ($HTTP_*_VARS). Instead, use the superglobals that were 85 | ; introduced in PHP 4.1.0 86 | ; - display_errors = Off [Security] 87 | ; With this directive set to off, errors that occur during the execution of 88 | ; scripts will no longer be displayed as a part of the script output, and thus, 89 | ; will no longer be exposed to remote users. With some errors, the error message 90 | ; content may expose information about your script, web server, or database 91 | ; server that may be exploitable for hacking. Production sites should have this 92 | ; directive set to off. 93 | ; - log_errors = On [Security] 94 | ; This directive complements the above one. Any errors that occur during the 95 | ; execution of your script will be logged (typically, to your server's error log, 96 | ; but can be configured in several ways). Along with setting display_errors to off, 97 | ; this setup gives you the ability to fully understand what may have gone wrong, 98 | ; without exposing any sensitive information to remote users. 99 | ; - output_buffering = 4096 [Performance] 100 | ; Set a 4KB output buffer. Enabling output buffering typically results in less 101 | ; writes, and sometimes less packets sent on the wire, which can often lead to 102 | ; better performance. The gain this directive actually yields greatly depends 103 | ; on which Web server you're working with, and what kind of scripts you're using. 104 | ; - register_argc_argv = Off [Performance] 105 | ; Disables registration of the somewhat redundant $argv and $argc global 106 | ; variables. 107 | ; - magic_quotes_gpc = Off [Performance] 108 | ; Input data is no longer escaped with slashes so that it can be sent into 109 | ; SQL databases without further manipulation. Instead, you should use the 110 | ; function addslashes() on each input element you wish to send to a database. 111 | ; - variables_order = "GPCS" [Performance] 112 | ; The environment variables are not hashed into the $_ENV. To access 113 | ; environment variables, you can use getenv() instead. 114 | ; - error_reporting = E_ALL [Code Cleanliness, Security(?)] 115 | ; By default, PHP surpresses errors of type E_NOTICE. These error messages 116 | ; are emitted for non-critical errors, but that could be a symptom of a bigger 117 | ; problem. Most notably, this will cause error messages about the use 118 | ; of uninitialized variables to be displayed. 119 | ; - allow_call_time_pass_reference = Off [Code cleanliness] 120 | ; It's not possible to decide to force a variable to be passed by reference 121 | ; when calling a function. The PHP 4 style to do this is by making the 122 | ; function require the relevant argument by reference. 123 | 124 | 125 | ;;;;;;;;;;;;;;;;;;;; 126 | ; Language Options ; 127 | ;;;;;;;;;;;;;;;;;;;; 128 | 129 | ; Enable the PHP scripting language engine under Apache. 130 | engine = On 131 | 132 | ; Enable compatibility mode with Zend Engine 1 (PHP 4.x) 133 | zend.ze1_compatibility_mode = Off 134 | 135 | ; Allow the tags are recognized. 136 | ; NOTE: Using short tags should be avoided when developing applications or 137 | ; libraries that are meant for redistribution, or deployment on PHP 138 | ; servers which are not under your control, because short tags may not 139 | ; be supported on the target server. For portable, redistributable code, 140 | ; be sure not to use short tags. 141 | short_open_tag = On 142 | 143 | ; Allow ASP-style <% %> tags. 144 | asp_tags = Off 145 | 146 | ; The number of significant digits displayed in floating point numbers. 147 | precision = 14 148 | 149 | ; Enforce year 2000 compliance (will cause problems with non-compliant browsers) 150 | y2k_compliance = On 151 | 152 | ; Output buffering allows you to send header lines (including cookies) even 153 | ; after you send body content, at the price of slowing PHP's output layer a 154 | ; bit. You can enable output buffering during runtime by calling the output 155 | ; buffering functions. You can also enable output buffering for all files by 156 | ; setting this directive to On. If you wish to limit the size of the buffer 157 | ; to a certain size - you can use a maximum number of bytes instead of 'On', as 158 | ; a value for this directive (e.g., output_buffering=4096). 159 | output_buffering = 4096 160 | 161 | ; You can redirect all of the output of your scripts to a function. For 162 | ; example, if you set output_handler to "mb_output_handler", character 163 | ; encoding will be transparently converted to the specified encoding. 164 | ; Setting any output handler automatically turns on output buffering. 165 | ; Note: People who wrote portable scripts should not depend on this ini 166 | ; directive. Instead, explicitly set the output handler using ob_start(). 167 | ; Using this ini directive may cause problems unless you know what script 168 | ; is doing. 169 | ; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" 170 | ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". 171 | ; Note: output_handler must be empty if this is set 'On' !!!! 172 | ; Instead you must use zlib.output_handler. 173 | ;output_handler = 174 | 175 | ; Transparent output compression using the zlib library 176 | ; Valid values for this option are 'off', 'on', or a specific buffer size 177 | ; to be used for compression (default is 4KB) 178 | ; Note: Resulting chunk size may vary due to nature of compression. PHP 179 | ; outputs chunks that are few hundreds bytes each as a result of 180 | ; compression. If you prefer a larger chunk size for better 181 | ; performance, enable output_buffering in addition. 182 | ; Note: You need to use zlib.output_handler instead of the standard 183 | ; output_handler, or otherwise the output will be corrupted. 184 | zlib.output_compression = Off 185 | 186 | ; You cannot specify additional output handlers if zlib.output_compression 187 | ; is activated here. This setting does the same as output_handler but in 188 | ; a different order. 189 | ;zlib.output_handler = 190 | 191 | ; Implicit flush tells PHP to tell the output layer to flush itself 192 | ; automatically after every output block. This is equivalent to calling the 193 | ; PHP function flush() after each and every call to print() or echo() and each 194 | ; and every HTML block. Turning this option on has serious performance 195 | ; implications and is generally recommended for debugging purposes only. 196 | implicit_flush = Off 197 | 198 | ; The unserialize callback function will be called (with the undefined class' 199 | ; name as parameter), if the unserializer finds an undefined class 200 | ; which should be instantiated. 201 | ; A warning appears if the specified function is not defined, or if the 202 | ; function doesn't include/implement the missing class. 203 | ; So only set this entry, if you really want to implement such a 204 | ; callback-function. 205 | unserialize_callback_func= 206 | 207 | ; When floats & doubles are serialized store serialize_precision significant 208 | ; digits after the floating point. The default value ensures that when floats 209 | ; are decoded with unserialize, the data will remain the same. 210 | serialize_precision = 100 211 | 212 | ; Whether to enable the ability to force arguments to be passed by reference 213 | ; at function call time. This method is deprecated and is likely to be 214 | ; unsupported in future versions of PHP/Zend. The encouraged method of 215 | ; specifying which arguments should be passed by reference is in the function 216 | ; declaration. You're encouraged to try and turn this option Off and make 217 | ; sure your scripts work properly with it in order to ensure they will work 218 | ; with future versions of the language (you will receive a warning each time 219 | ; you use this feature, and the argument will be passed by value instead of by 220 | ; reference). 221 | allow_call_time_pass_reference = Off 222 | 223 | ; 224 | ; Safe Mode 225 | ; 226 | safe_mode = Off 227 | 228 | ; By default, Safe Mode does a UID compare check when 229 | ; opening files. If you want to relax this to a GID compare, 230 | ; then turn on safe_mode_gid. 231 | safe_mode_gid = Off 232 | 233 | ; When safe_mode is on, UID/GID checks are bypassed when 234 | ; including files from this directory and its subdirectories. 235 | ; (directory must also be in include_path or full path must 236 | ; be used when including) 237 | safe_mode_include_dir = 238 | 239 | ; When safe_mode is on, only executables located in the safe_mode_exec_dir 240 | ; will be allowed to be executed via the exec family of functions. 241 | safe_mode_exec_dir = 242 | 243 | ; Setting certain environment variables may be a potential security breach. 244 | ; This directive contains a comma-delimited list of prefixes. In Safe Mode, 245 | ; the user may only alter environment variables whose names begin with the 246 | ; prefixes supplied here. By default, users will only be able to set 247 | ; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). 248 | ; 249 | ; Note: If this directive is empty, PHP will let the user modify ANY 250 | ; environment variable! 251 | safe_mode_allowed_env_vars = PHP_ 252 | 253 | ; This directive contains a comma-delimited list of environment variables that 254 | ; the end user won't be able to change using putenv(). These variables will be 255 | ; protected even if safe_mode_allowed_env_vars is set to allow to change them. 256 | safe_mode_protected_env_vars = LD_LIBRARY_PATH 257 | 258 | ; open_basedir, if set, limits all file operations to the defined directory 259 | ; and below. This directive makes most sense if used in a per-directory 260 | ; or per-virtualhost web server configuration file. This directive is 261 | ; *NOT* affected by whether Safe Mode is turned On or Off. 262 | ;open_basedir = 263 | 264 | ; This directive allows you to disable certain functions for security reasons. 265 | ; It receives a comma-delimited list of function names. This directive is 266 | ; *NOT* affected by whether Safe Mode is turned On or Off. 267 | disable_functions = 268 | 269 | ; This directive allows you to disable certain classes for security reasons. 270 | ; It receives a comma-delimited list of class names. This directive is 271 | ; *NOT* affected by whether Safe Mode is turned On or Off. 272 | disable_classes = 273 | 274 | ; Colors for Syntax Highlighting mode. Anything that's acceptable in 275 | ; would work. 276 | ;highlight.string = #DD0000 277 | ;highlight.comment = #FF9900 278 | ;highlight.keyword = #007700 279 | ;highlight.bg = #FFFFFF 280 | ;highlight.default = #0000BB 281 | ;highlight.html = #000000 282 | 283 | ; If enabled, the request will be allowed to complete even if the user aborts 284 | ; the request. Consider enabling it if executing long request, which may end up 285 | ; being interrupted by the user or a browser timing out. 286 | ; ignore_user_abort = On 287 | 288 | ; Determines the size of the realpath cache to be used by PHP. This value should 289 | ; be increased on systems where PHP opens many files to reflect the quantity of 290 | ; the file operations performed. 291 | ; realpath_cache_size=16k 292 | 293 | ; Duration of time, in seconds for which to cache realpath information for a given 294 | ; file or directory. For systems with rarely changing files, consider increasing this 295 | ; value. 296 | ; realpath_cache_ttl=120 297 | 298 | ; 299 | ; Misc 300 | ; 301 | ; Decides whether PHP may expose the fact that it is installed on the server 302 | ; (e.g. by adding its signature to the Web server header). It is no security 303 | ; threat in any way, but it makes it possible to determine whether you use PHP 304 | ; on your server or not. 305 | expose_php = On 306 | 307 | 308 | ;;;;;;;;;;;;;;;;;;; 309 | ; Resource Limits ; 310 | ;;;;;;;;;;;;;;;;;;; 311 | 312 | max_execution_time = 30 ; Maximum execution time of each script, in seconds 313 | max_input_time = 60 ; Maximum amount of time each script may spend parsing request data 314 | memory_limit = 128M ; Maximum amount of memory a script may consume 315 | 316 | 317 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 318 | ; Error handling and logging ; 319 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 320 | 321 | ; error_reporting is a bit-field. Or each number up to get desired error 322 | ; reporting level 323 | ; E_ALL - All errors and warnings (doesn't include E_STRICT) 324 | ; E_ERROR - fatal run-time errors 325 | ; E_WARNING - run-time warnings (non-fatal errors) 326 | ; E_PARSE - compile-time parse errors 327 | ; E_NOTICE - run-time notices (these are warnings which often result 328 | ; from a bug in your code, but it's possible that it was 329 | ; intentional (e.g., using an uninitialized variable and 330 | ; relying on the fact it's automatically initialized to an 331 | ; empty string) 332 | ; E_STRICT - run-time notices, enable to have PHP suggest changes 333 | ; to your code which will ensure the best interoperability 334 | ; and forward compatibility of your code 335 | ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup 336 | ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's 337 | ; initial startup 338 | ; E_COMPILE_ERROR - fatal compile-time errors 339 | ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) 340 | ; E_USER_ERROR - user-generated error message 341 | ; E_USER_WARNING - user-generated warning message 342 | ; E_USER_NOTICE - user-generated notice message 343 | ; 344 | ; Examples: 345 | ; 346 | ; - Show all errors, except for notices and coding standards warnings 347 | ; 348 | ;error_reporting = E_ALL & ~E_NOTICE 349 | ; 350 | ; - Show all errors, except for notices 351 | ; 352 | ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT 353 | ; 354 | ; - Show only errors 355 | ; 356 | ;error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR 357 | ; 358 | ; - Show all errors, except coding standards warnings 359 | ; 360 | error_reporting = E_ALL 361 | 362 | ; Print out errors (as a part of the output). For production web sites, 363 | ; you're strongly encouraged to turn this feature off, and use error logging 364 | ; instead (see below). Keeping display_errors enabled on a production web site 365 | ; may reveal security information to end users, such as file paths on your Web 366 | ; server, your database schema or other information. 367 | display_errors = Off 368 | 369 | ; Even when display_errors is on, errors that occur during PHP's startup 370 | ; sequence are not displayed. It's strongly recommended to keep 371 | ; display_startup_errors off, except for when debugging. 372 | display_startup_errors = Off 373 | 374 | ; Log errors into a log file (server-specific log, stderr, or error_log (below)) 375 | ; As stated above, you're strongly advised to use error logging in place of 376 | ; error displaying on production web sites. 377 | log_errors = On 378 | 379 | ; Set maximum length of log_errors. In error_log information about the source is 380 | ; added. The default is 1024 and 0 allows to not apply any maximum length at all. 381 | log_errors_max_len = 1024 382 | 383 | ; Do not log repeated messages. Repeated errors must occur in same file on same 384 | ; line until ignore_repeated_source is set true. 385 | ignore_repeated_errors = Off 386 | 387 | ; Ignore source of message when ignoring repeated messages. When this setting 388 | ; is On you will not log errors with repeated messages from different files or 389 | ; sourcelines. 390 | ignore_repeated_source = Off 391 | 392 | ; If this parameter is set to Off, then memory leaks will not be shown (on 393 | ; stdout or in the log). This has only effect in a debug compile, and if 394 | ; error reporting includes E_WARNING in the allowed list 395 | report_memleaks = On 396 | 397 | ; Store the last error/warning message in $php_errormsg (boolean). 398 | track_errors = Off 399 | 400 | ; Disable the inclusion of HTML tags in error messages. 401 | ; Note: Never use this feature for production boxes. 402 | ;html_errors = Off 403 | 404 | ; If html_errors is set On PHP produces clickable error messages that direct 405 | ; to a page describing the error or function causing the error in detail. 406 | ; You can download a copy of the PHP manual from http://www.php.net/docs.php 407 | ; and change docref_root to the base URL of your local copy including the 408 | ; leading '/'. You must also specify the file extension being used including 409 | ; the dot. 410 | ; Note: Never use this feature for production boxes. 411 | ;docref_root = "/phpmanual/" 412 | ;docref_ext = .html 413 | 414 | ; String to output before an error message. 415 | ;error_prepend_string = "" 416 | 417 | ; String to output after an error message. 418 | ;error_append_string = "" 419 | 420 | ; Log errors to specified file. 421 | ;error_log = filename 422 | 423 | ; Log errors to syslog (Event Log on NT, not valid in Windows 95). 424 | ;error_log = syslog 425 | 426 | 427 | ;;;;;;;;;;;;;;;;; 428 | ; Data Handling ; 429 | ;;;;;;;;;;;;;;;;; 430 | ; 431 | ; Note - track_vars is ALWAYS enabled as of PHP 4.0.3 432 | 433 | ; The separator used in PHP generated URLs to separate arguments. 434 | ; Default is "&". 435 | ;arg_separator.output = "&" 436 | 437 | ; List of separator(s) used by PHP to parse input URLs into variables. 438 | ; Default is "&". 439 | ; NOTE: Every character in this directive is considered as separator! 440 | ;arg_separator.input = ";&" 441 | 442 | ; This directive describes the order in which PHP registers GET, POST, Cookie, 443 | ; Environment and Built-in variables (G, P, C, E & S respectively, often 444 | ; referred to as EGPCS or GPC). Registration is done from left to right, newer 445 | ; values override older values. 446 | variables_order = "EGPCS" 447 | 448 | ; Whether or not to register the EGPCS variables as global variables. You may 449 | ; want to turn this off if you don't want to clutter your scripts' global scope 450 | ; with user data. This makes most sense when coupled with track_vars - in which 451 | ; case you can access all of the GPC variables through the $HTTP_*_VARS[], 452 | ; variables. 453 | ; 454 | ; You should do your best to write your scripts so that they do not require 455 | ; register_globals to be on; Using form variables as globals can easily lead 456 | ; to possible security problems, if the code is not very well thought of. 457 | register_globals = Off 458 | 459 | ; Whether or not to register the old-style input arrays, HTTP_GET_VARS 460 | ; and friends. If you're not using them, it's recommended to turn them off, 461 | ; for performance reasons. 462 | register_long_arrays = Off 463 | 464 | ; This directive tells PHP whether to declare the argv&argc variables (that 465 | ; would contain the GET information). If you don't use these variables, you 466 | ; should turn it off for increased performance. 467 | register_argc_argv = Off 468 | 469 | ; When enabled, the SERVER and ENV variables are created when they're first 470 | ; used (Just In Time) instead of when the script starts. If these variables 471 | ; are not used within a script, having this directive on will result in a 472 | ; performance gain. The PHP directives register_globals, register_long_arrays, 473 | ; and register_argc_argv must be disabled for this directive to have any affect. 474 | auto_globals_jit = On 475 | 476 | ; Maximum size of POST data that PHP will accept. 477 | post_max_size = 8M 478 | 479 | ; Magic quotes 480 | ; 481 | 482 | ; Magic quotes for incoming GET/POST/Cookie data. 483 | magic_quotes_gpc = Off 484 | 485 | ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. 486 | magic_quotes_runtime = Off 487 | 488 | ; Use Sybase-style magic quotes (escape ' with '' instead of \'). 489 | magic_quotes_sybase = Off 490 | 491 | ; Automatically add files before or after any PHP document. 492 | auto_prepend_file = 493 | auto_append_file = 494 | 495 | ; As of 4.0b4, PHP always outputs a character encoding by default in 496 | ; the Content-type: header. To disable sending of the charset, simply 497 | ; set it to be empty. 498 | ; 499 | ; PHP's built-in default is text/html 500 | default_mimetype = "text/html" 501 | ;default_charset = "iso-8859-1" 502 | 503 | ; Always populate the $HTTP_RAW_POST_DATA variable. 504 | ;always_populate_raw_post_data = On 505 | 506 | 507 | ;;;;;;;;;;;;;;;;;;;;;;;;; 508 | ; Paths and Directories ; 509 | ;;;;;;;;;;;;;;;;;;;;;;;;; 510 | 511 | ; UNIX: "/path1:/path2" 512 | ;include_path = ".:/php/includes" 513 | ; 514 | ; Windows: "\path1;\path2" 515 | ;include_path = ".;c:\php\includes" 516 | 517 | ; The root of the PHP pages, used only if nonempty. 518 | ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root 519 | ; if you are running php as a CGI under any web server (other than IIS) 520 | ; see documentation for security issues. The alternate is to use the 521 | ; cgi.force_redirect configuration below 522 | doc_root = 523 | 524 | ; The directory under which PHP opens the script using /~username used only 525 | ; if nonempty. 526 | user_dir = 527 | 528 | ; Directory in which the loadable extensions (modules) reside. 529 | extension_dir = "<%= @php_ext_dir %>" 530 | 531 | ; Whether or not to enable the dl() function. The dl() function does NOT work 532 | ; properly in multithreaded servers, such as IIS or Zeus, and is automatically 533 | ; disabled on them. 534 | enable_dl = On 535 | 536 | ; cgi.force_redirect is necessary to provide security running PHP as a CGI under 537 | ; most web servers. Left undefined, PHP turns this on by default. You can 538 | ; turn it off here AT YOUR OWN RISK 539 | ; **You CAN safely turn this off for IIS, in fact, you MUST.** 540 | ; cgi.force_redirect = 1 541 | 542 | ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with 543 | ; every request. 544 | ; cgi.nph = 1 545 | 546 | ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape 547 | ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP 548 | ; will look for to know it is OK to continue execution. Setting this variable MAY 549 | ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. 550 | ; cgi.redirect_status_env = ; 551 | 552 | ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate 553 | ; security tokens of the calling client. This allows IIS to define the 554 | ; security context that the request runs under. mod_fastcgi under Apache 555 | ; does not currently support this feature (03/17/2002) 556 | ; Set to 1 if running under IIS. Default is zero. 557 | ; fastcgi.impersonate = 1; 558 | 559 | ; Disable logging through FastCGI connection 560 | ; fastcgi.log = 0 561 | 562 | ; cgi.rfc2616_headers configuration option tells PHP what type of headers to 563 | ; use when sending HTTP response code. If it's set 0 PHP sends Status: header that 564 | ; is supported by Apache. When this option is set to 1 PHP will send 565 | ; RFC2616 compliant header. 566 | ; Default is zero. 567 | ;cgi.rfc2616_headers = 0 568 | 569 | 570 | ;;;;;;;;;;;;;;;; 571 | ; File Uploads ; 572 | ;;;;;;;;;;;;;;;; 573 | 574 | ; Whether to allow HTTP file uploads. 575 | file_uploads = On 576 | 577 | ; Temporary directory for HTTP uploaded files (will use system default if not 578 | ; specified). 579 | ;upload_tmp_dir = 580 | 581 | ; Maximum allowed size for uploaded files. 582 | upload_max_filesize = 2M 583 | 584 | 585 | ;;;;;;;;;;;;;;;;;; 586 | ; Fopen wrappers ; 587 | ;;;;;;;;;;;;;;;;;; 588 | 589 | ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. 590 | allow_url_fopen = On 591 | 592 | ; Define the anonymous ftp password (your email address) 593 | ;from="john@doe.com" 594 | 595 | ; Define the User-Agent string 596 | ; user_agent="PHP" 597 | 598 | ; Default timeout for socket based streams (seconds) 599 | default_socket_timeout = 60 600 | 601 | ; If your scripts have to deal with files from Macintosh systems, 602 | ; or you are running on a Mac and need to deal with files from 603 | ; unix or win32 systems, setting this flag will cause PHP to 604 | ; automatically detect the EOL character in those files so that 605 | ; fgets() and file() will work regardless of the source of the file. 606 | ; auto_detect_line_endings = Off 607 | 608 | 609 | ;;;;;;;;;;;;;;;;;;;;;; 610 | ; Dynamic Extensions ; 611 | ;;;;;;;;;;;;;;;;;;;;;; 612 | ; 613 | ; If you wish to have an extension loaded automatically, use the following 614 | ; syntax: 615 | ; 616 | ; extension=modulename.extension 617 | ; 618 | ; For example: 619 | ; 620 | ; extension=msql.so 621 | ; 622 | ; Note that it should be the name of the module only; no directory information 623 | ; needs to go here. Specify the location of the extension with the 624 | ; extension_dir directive above. 625 | 626 | 627 | ;;;; 628 | ; Note: packaged extension modules are now loaded via the .ini files 629 | ; found in the directory /etc/php.d; these are loaded by default. 630 | ;;;; 631 | 632 | 633 | ;;;;;;;;;;;;;;;;;;; 634 | ; Module Settings ; 635 | ;;;;;;;;;;;;;;;;;;; 636 | 637 | [Date] 638 | ; Defines the default timezone used by the date functions 639 | ;date.timezone = 640 | 641 | [Syslog] 642 | ; Whether or not to define the various syslog variables (e.g. $LOG_PID, 643 | ; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In 644 | ; runtime, you can define these variables by calling define_syslog_variables(). 645 | define_syslog_variables = Off 646 | 647 | [mail function] 648 | ; For Win32 only. 649 | SMTP = localhost 650 | smtp_port = 25 651 | 652 | ; For Win32 only. 653 | ;sendmail_from = me@example.com 654 | 655 | ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). 656 | sendmail_path = /usr/sbin/sendmail -t -i 657 | 658 | ; Force the addition of the specified parameters to be passed as extra parameters 659 | ; to the sendmail binary. These parameters will always replace the value of 660 | ; the 5th parameter to mail(), even in safe mode. 661 | ;mail.force_extra_parameters = 662 | 663 | [SQL] 664 | sql.safe_mode = Off 665 | 666 | [ODBC] 667 | ;odbc.default_db = Not yet implemented 668 | ;odbc.default_user = Not yet implemented 669 | ;odbc.default_pw = Not yet implemented 670 | 671 | ; Allow or prevent persistent links. 672 | odbc.allow_persistent = On 673 | 674 | ; Check that a connection is still valid before reuse. 675 | odbc.check_persistent = On 676 | 677 | ; Maximum number of persistent links. -1 means no limit. 678 | odbc.max_persistent = -1 679 | 680 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 681 | odbc.max_links = -1 682 | 683 | ; Handling of LONG fields. Returns number of bytes to variables. 0 means 684 | ; passthru. 685 | odbc.defaultlrl = 4096 686 | 687 | ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. 688 | ; See the documentation on odbc_binmode and odbc_longreadlen for an explanation 689 | ; of uodbc.defaultlrl and uodbc.defaultbinmode 690 | odbc.defaultbinmode = 1 691 | 692 | [MySQL] 693 | ; Allow or prevent persistent links. 694 | mysql.allow_persistent = On 695 | 696 | ; Maximum number of persistent links. -1 means no limit. 697 | mysql.max_persistent = -1 698 | 699 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 700 | mysql.max_links = -1 701 | 702 | ; Default port number for mysql_connect(). If unset, mysql_connect() will use 703 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 704 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 705 | ; at MYSQL_PORT. 706 | mysql.default_port = 707 | 708 | ; Default socket name for local MySQL connects. If empty, uses the built-in 709 | ; MySQL defaults. 710 | mysql.default_socket = 711 | 712 | ; Default host for mysql_connect() (doesn't apply in safe mode). 713 | mysql.default_host = 714 | 715 | ; Default user for mysql_connect() (doesn't apply in safe mode). 716 | mysql.default_user = 717 | 718 | ; Default password for mysql_connect() (doesn't apply in safe mode). 719 | ; Note that this is generally a *bad* idea to store passwords in this file. 720 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") 721 | ; and reveal this password! And of course, any users with read access to this 722 | ; file will be able to reveal the password as well. 723 | mysql.default_password = 724 | 725 | ; Maximum time (in secondes) for connect timeout. -1 means no limit 726 | mysql.connect_timeout = 60 727 | 728 | ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and 729 | ; SQL-Errors will be displayed. 730 | mysql.trace_mode = Off 731 | 732 | [MySQLi] 733 | 734 | ; Maximum number of links. -1 means no limit. 735 | mysqli.max_links = -1 736 | 737 | ; Default port number for mysqli_connect(). If unset, mysqli_connect() will use 738 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 739 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 740 | ; at MYSQL_PORT. 741 | mysqli.default_port = 3306 742 | 743 | ; Default socket name for local MySQL connects. If empty, uses the built-in 744 | ; MySQL defaults. 745 | mysqli.default_socket = 746 | 747 | ; Default host for mysql_connect() (doesn't apply in safe mode). 748 | mysqli.default_host = 749 | 750 | ; Default user for mysql_connect() (doesn't apply in safe mode). 751 | mysqli.default_user = 752 | 753 | ; Default password for mysqli_connect() (doesn't apply in safe mode). 754 | ; Note that this is generally a *bad* idea to store passwords in this file. 755 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") 756 | ; and reveal this password! And of course, any users with read access to this 757 | ; file will be able to reveal the password as well. 758 | mysqli.default_pw = 759 | 760 | ; Allow or prevent reconnect 761 | mysqli.reconnect = Off 762 | 763 | [mSQL] 764 | ; Allow or prevent persistent links. 765 | msql.allow_persistent = On 766 | 767 | ; Maximum number of persistent links. -1 means no limit. 768 | msql.max_persistent = -1 769 | 770 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 771 | msql.max_links = -1 772 | 773 | [PostgresSQL] 774 | ; Allow or prevent persistent links. 775 | pgsql.allow_persistent = On 776 | 777 | ; Detect broken persistent links always with pg_pconnect(). 778 | ; Auto reset feature requires a little overheads. 779 | pgsql.auto_reset_persistent = Off 780 | 781 | ; Maximum number of persistent links. -1 means no limit. 782 | pgsql.max_persistent = -1 783 | 784 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 785 | pgsql.max_links = -1 786 | 787 | ; Ignore PostgreSQL backends Notice message or not. 788 | ; Notice message logging require a little overheads. 789 | pgsql.ignore_notice = 0 790 | 791 | ; Log PostgreSQL backends Noitce message or not. 792 | ; Unless pgsql.ignore_notice=0, module cannot log notice message. 793 | pgsql.log_notice = 0 794 | 795 | [Sybase] 796 | ; Allow or prevent persistent links. 797 | sybase.allow_persistent = On 798 | 799 | ; Maximum number of persistent links. -1 means no limit. 800 | sybase.max_persistent = -1 801 | 802 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 803 | sybase.max_links = -1 804 | 805 | ;sybase.interface_file = "/usr/sybase/interfaces" 806 | 807 | ; Minimum error severity to display. 808 | sybase.min_error_severity = 10 809 | 810 | ; Minimum message severity to display. 811 | sybase.min_message_severity = 10 812 | 813 | ; Compatability mode with old versions of PHP 3.0. 814 | ; If on, this will cause PHP to automatically assign types to results according 815 | ; to their Sybase type, instead of treating them all as strings. This 816 | ; compatability mode will probably not stay around forever, so try applying 817 | ; whatever necessary changes to your code, and turn it off. 818 | sybase.compatability_mode = Off 819 | 820 | [Sybase-CT] 821 | ; Allow or prevent persistent links. 822 | sybct.allow_persistent = On 823 | 824 | ; Maximum number of persistent links. -1 means no limit. 825 | sybct.max_persistent = -1 826 | 827 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 828 | sybct.max_links = -1 829 | 830 | ; Minimum server message severity to display. 831 | sybct.min_server_severity = 10 832 | 833 | ; Minimum client message severity to display. 834 | sybct.min_client_severity = 10 835 | 836 | [bcmath] 837 | ; Number of decimal digits for all bcmath functions. 838 | bcmath.scale = 0 839 | 840 | [browscap] 841 | ;browscap = extra/browscap.ini 842 | 843 | [Informix] 844 | ; Default host for ifx_connect() (doesn't apply in safe mode). 845 | ifx.default_host = 846 | 847 | ; Default user for ifx_connect() (doesn't apply in safe mode). 848 | ifx.default_user = 849 | 850 | ; Default password for ifx_connect() (doesn't apply in safe mode). 851 | ifx.default_password = 852 | 853 | ; Allow or prevent persistent links. 854 | ifx.allow_persistent = On 855 | 856 | ; Maximum number of persistent links. -1 means no limit. 857 | ifx.max_persistent = -1 858 | 859 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 860 | ifx.max_links = -1 861 | 862 | ; If on, select statements return the contents of a text blob instead of its id. 863 | ifx.textasvarchar = 0 864 | 865 | ; If on, select statements return the contents of a byte blob instead of its id. 866 | ifx.byteasvarchar = 0 867 | 868 | ; Trailing blanks are stripped from fixed-length char columns. May help the 869 | ; life of Informix SE users. 870 | ifx.charasvarchar = 0 871 | 872 | ; If on, the contents of text and byte blobs are dumped to a file instead of 873 | ; keeping them in memory. 874 | ifx.blobinfile = 0 875 | 876 | ; NULL's are returned as empty strings, unless this is set to 1. In that case, 877 | ; NULL's are returned as string 'NULL'. 878 | ifx.nullformat = 0 879 | 880 | [Session] 881 | ; Handler used to store/retrieve data. 882 | session.save_handler = files 883 | 884 | ; Argument passed to save_handler. In the case of files, this is the path 885 | ; where data files are stored. Note: Windows users have to change this 886 | ; variable in order to use PHP's session functions. 887 | ; 888 | ; As of PHP 4.0.1, you can define the path as: 889 | ; 890 | ; session.save_path = "N;/path" 891 | ; 892 | ; where N is an integer. Instead of storing all the session files in 893 | ; /path, what this will do is use subdirectories N-levels deep, and 894 | ; store the session data in those directories. This is useful if you 895 | ; or your OS have problems with lots of files in one directory, and is 896 | ; a more efficient layout for servers that handle lots of sessions. 897 | ; 898 | ; NOTE 1: PHP will not create this directory structure automatically. 899 | ; You can use the script in the ext/session dir for that purpose. 900 | ; NOTE 2: See the section on garbage collection below if you choose to 901 | ; use subdirectories for session storage 902 | ; 903 | ; The file storage module creates files using mode 600 by default. 904 | ; You can change that by using 905 | ; 906 | ; session.save_path = "N;MODE;/path" 907 | ; 908 | ; where MODE is the octal representation of the mode. Note that this 909 | ; does not overwrite the process's umask. 910 | session.save_path = "/var/lib/php/session" 911 | 912 | ; Whether to use cookies. 913 | session.use_cookies = 1 914 | 915 | ; This option enables administrators to make their users invulnerable to 916 | ; attacks which involve passing session ids in URLs; defaults to 0. 917 | ; session.use_only_cookies = 1 918 | 919 | ; Name of the session (used as cookie name). 920 | session.name = PHPSESSID 921 | 922 | ; Initialize session on request startup. 923 | session.auto_start = 0 924 | 925 | ; Lifetime in seconds of cookie or, if 0, until browser is restarted. 926 | session.cookie_lifetime = 0 927 | 928 | ; The path for which the cookie is valid. 929 | session.cookie_path = / 930 | 931 | ; The domain for which the cookie is valid. 932 | session.cookie_domain = 933 | 934 | ; Handler used to serialize data. php is the standard serializer of PHP. 935 | session.serialize_handler = php 936 | 937 | ; Define the probability that the 'garbage collection' process is started 938 | ; on every session initialization. 939 | ; The probability is calculated by using gc_probability/gc_divisor, 940 | ; e.g. 1/100 means there is a 1% chance that the GC process starts 941 | ; on each request. 942 | 943 | session.gc_probability = 1 944 | session.gc_divisor = 1000 945 | 946 | ; After this number of seconds, stored data will be seen as 'garbage' and 947 | ; cleaned up by the garbage collection process. 948 | session.gc_maxlifetime = 1440 949 | 950 | ; NOTE: If you are using the subdirectory option for storing session files 951 | ; (see session.save_path above), then garbage collection does *not* 952 | ; happen automatically. You will need to do your own garbage 953 | ; collection through a shell script, cron entry, or some other method. 954 | ; For example, the following script would is the equivalent of 955 | ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): 956 | ; cd /path/to/sessions; find -cmin +24 | xargs rm 957 | 958 | ; PHP 4.2 and less have an undocumented feature/bug that allows you to 959 | ; to initialize a session variable in the global scope, albeit register_globals 960 | ; is disabled. PHP 4.3 and later will warn you, if this feature is used. 961 | ; You can disable the feature and the warning separately. At this time, 962 | ; the warning is only displayed, if bug_compat_42 is enabled. 963 | 964 | session.bug_compat_42 = 0 965 | session.bug_compat_warn = 1 966 | 967 | ; Check HTTP Referer to invalidate externally stored URLs containing ids. 968 | ; HTTP_REFERER has to contain this substring for the session to be 969 | ; considered as valid. 970 | session.referer_check = 971 | 972 | ; How many bytes to read from the file. 973 | session.entropy_length = 0 974 | 975 | ; Specified here to create the session id. 976 | session.entropy_file = 977 | 978 | ;session.entropy_length = 16 979 | 980 | ;session.entropy_file = /dev/urandom 981 | 982 | ; Set to {nocache,private,public,} to determine HTTP caching aspects 983 | ; or leave this empty to avoid sending anti-caching headers. 984 | session.cache_limiter = nocache 985 | 986 | ; Document expires after n minutes. 987 | session.cache_expire = 180 988 | 989 | ; trans sid support is disabled by default. 990 | ; Use of trans sid may risk your users security. 991 | ; Use this option with caution. 992 | ; - User may send URL contains active session ID 993 | ; to other person via. email/irc/etc. 994 | ; - URL that contains active session ID may be stored 995 | ; in publically accessible computer. 996 | ; - User may access your site with the same session ID 997 | ; always using URL stored in browser's history or bookmarks. 998 | session.use_trans_sid = 0 999 | 1000 | ; Select a hash function 1001 | ; 0: MD5 (128 bits) 1002 | ; 1: SHA-1 (160 bits) 1003 | session.hash_function = 0 1004 | 1005 | ; Define how many bits are stored in each character when converting 1006 | ; the binary hash data to something readable. 1007 | ; 1008 | ; 4 bits: 0-9, a-f 1009 | ; 5 bits: 0-9, a-v 1010 | ; 6 bits: 0-9, a-z, A-Z, "-", "," 1011 | session.hash_bits_per_character = 5 1012 | 1013 | ; The URL rewriter will look for URLs in a defined set of HTML tags. 1014 | ; form/fieldset are special; if you include them here, the rewriter will 1015 | ; add a hidden field with the info which is otherwise appended 1016 | ; to URLs. If you want XHTML conformity, remove the form entry. 1017 | ; Note that all valid entries require a "=", even if no value follows. 1018 | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" 1019 | 1020 | [MSSQL] 1021 | ; Allow or prevent persistent links. 1022 | mssql.allow_persistent = On 1023 | 1024 | ; Maximum number of persistent links. -1 means no limit. 1025 | mssql.max_persistent = -1 1026 | 1027 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 1028 | mssql.max_links = -1 1029 | 1030 | ; Minimum error severity to display. 1031 | mssql.min_error_severity = 10 1032 | 1033 | ; Minimum message severity to display. 1034 | mssql.min_message_severity = 10 1035 | 1036 | ; Compatability mode with old versions of PHP 3.0. 1037 | mssql.compatability_mode = Off 1038 | 1039 | ; Connect timeout 1040 | ;mssql.connect_timeout = 5 1041 | 1042 | ; Query timeout 1043 | ;mssql.timeout = 60 1044 | 1045 | ; Valid range 0 - 2147483647. Default = 4096. 1046 | ;mssql.textlimit = 4096 1047 | 1048 | ; Valid range 0 - 2147483647. Default = 4096. 1049 | ;mssql.textsize = 4096 1050 | 1051 | ; Limits the number of records in each batch. 0 = all records in one batch. 1052 | ;mssql.batchsize = 0 1053 | 1054 | ; Specify how datetime and datetim4 columns are returned 1055 | ; On => Returns data converted to SQL server settings 1056 | ; Off => Returns values as YYYY-MM-DD hh:mm:ss 1057 | ;mssql.datetimeconvert = On 1058 | 1059 | ; Use NT authentication when connecting to the server 1060 | mssql.secure_connection = Off 1061 | 1062 | ; Specify max number of processes. -1 = library default 1063 | ; msdlib defaults to 25 1064 | ; FreeTDS defaults to 4096 1065 | ;mssql.max_procs = -1 1066 | 1067 | ; Specify client character set. 1068 | ; If empty or not set the client charset from freetds.comf is used 1069 | ; This is only used when compiled with FreeTDS 1070 | ;mssql.charset = "ISO-8859-1" 1071 | 1072 | [Assertion] 1073 | ; Assert(expr); active by default. 1074 | ;assert.active = On 1075 | 1076 | ; Issue a PHP warning for each failed assertion. 1077 | ;assert.warning = On 1078 | 1079 | ; Don't bail out by default. 1080 | ;assert.bail = Off 1081 | 1082 | ; User-function to be called if an assertion fails. 1083 | ;assert.callback = 0 1084 | 1085 | ; Eval the expression with current error_reporting(). Set to true if you want 1086 | ; error_reporting(0) around the eval(). 1087 | ;assert.quiet_eval = 0 1088 | 1089 | [Verisign Payflow Pro] 1090 | ; Default Payflow Pro server. 1091 | pfpro.defaulthost = "test-payflow.verisign.com" 1092 | 1093 | ; Default port to connect to. 1094 | pfpro.defaultport = 443 1095 | 1096 | ; Default timeout in seconds. 1097 | pfpro.defaulttimeout = 30 1098 | 1099 | ; Default proxy IP address (if required). 1100 | ;pfpro.proxyaddress = 1101 | 1102 | ; Default proxy port. 1103 | ;pfpro.proxyport = 1104 | 1105 | ; Default proxy logon. 1106 | ;pfpro.proxylogon = 1107 | 1108 | ; Default proxy password. 1109 | ;pfpro.proxypassword = 1110 | 1111 | [COM] 1112 | ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs 1113 | ;com.typelib_file = 1114 | ; allow Distributed-COM calls 1115 | ;com.allow_dcom = true 1116 | ; autoregister constants of a components typlib on com_load() 1117 | ;com.autoregister_typelib = true 1118 | ; register constants casesensitive 1119 | ;com.autoregister_casesensitive = false 1120 | ; show warnings on duplicate constat registrations 1121 | ;com.autoregister_verbose = true 1122 | 1123 | [mbstring] 1124 | ; language for internal character representation. 1125 | ;mbstring.language = Japanese 1126 | 1127 | ; internal/script encoding. 1128 | ; Some encoding cannot work as internal encoding. 1129 | ; (e.g. SJIS, BIG5, ISO-2022-*) 1130 | ;mbstring.internal_encoding = EUC-JP 1131 | 1132 | ; http input encoding. 1133 | ;mbstring.http_input = auto 1134 | 1135 | ; http output encoding. mb_output_handler must be 1136 | ; registered as output buffer to function 1137 | ;mbstring.http_output = SJIS 1138 | 1139 | ; enable automatic encoding translation according to 1140 | ; mbstring.internal_encoding setting. Input chars are 1141 | ; converted to internal encoding by setting this to On. 1142 | ; Note: Do _not_ use automatic encoding translation for 1143 | ; portable libs/applications. 1144 | ;mbstring.encoding_translation = Off 1145 | 1146 | ; automatic encoding detection order. 1147 | ; auto means 1148 | ;mbstring.detect_order = auto 1149 | 1150 | ; substitute_character used when character cannot be converted 1151 | ; one from another 1152 | ;mbstring.substitute_character = none; 1153 | 1154 | ; overload(replace) single byte functions by mbstring functions. 1155 | ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), 1156 | ; etc. Possible values are 0,1,2,4 or combination of them. 1157 | ; For example, 7 for overload everything. 1158 | ; 0: No overload 1159 | ; 1: Overload mail() function 1160 | ; 2: Overload str*() functions 1161 | ; 4: Overload ereg*() functions 1162 | ;mbstring.func_overload = 0 1163 | 1164 | ; enable strict encoding detection. 1165 | ;mbstring.strict_encoding = Off 1166 | 1167 | [FrontBase] 1168 | ;fbsql.allow_persistent = On 1169 | ;fbsql.autocommit = On 1170 | ;fbsql.default_database = 1171 | ;fbsql.default_database_password = 1172 | ;fbsql.default_host = 1173 | ;fbsql.default_password = 1174 | ;fbsql.default_user = "_SYSTEM" 1175 | ;fbsql.generate_warnings = Off 1176 | ;fbsql.max_connections = 128 1177 | ;fbsql.max_links = 128 1178 | ;fbsql.max_persistent = -1 1179 | ;fbsql.max_results = 128 1180 | ;fbsql.batchSize = 1000 1181 | 1182 | [gd] 1183 | ; Tell the jpeg decode to libjpeg warnings and try to create 1184 | ; a gd image. The warning will then be displayed as notices 1185 | ; disabled by default 1186 | ;gd.jpeg_ignore_warning = 0 1187 | 1188 | [exif] 1189 | ; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. 1190 | ; With mbstring support this will automatically be converted into the encoding 1191 | ; given by corresponding encode setting. When empty mbstring.internal_encoding 1192 | ; is used. For the decode settings you can distinguish between motorola and 1193 | ; intel byte order. A decode setting cannot be empty. 1194 | ;exif.encode_unicode = ISO-8859-15 1195 | ;exif.decode_unicode_motorola = UCS-2BE 1196 | ;exif.decode_unicode_intel = UCS-2LE 1197 | ;exif.encode_jis = 1198 | ;exif.decode_jis_motorola = JIS 1199 | ;exif.decode_jis_intel = JIS 1200 | 1201 | [Tidy] 1202 | ; The path to a default tidy configuration file to use when using tidy 1203 | ;tidy.default_config = /usr/local/lib/php/default.tcfg 1204 | 1205 | ; Should tidy clean and repair output automatically? 1206 | ; WARNING: Do not use this option if you are generating non-html content 1207 | ; such as dynamic images 1208 | tidy.clean_output = Off 1209 | 1210 | [soap] 1211 | ; Enables or disables WSDL caching feature. 1212 | soap.wsdl_cache_enabled=1 1213 | ; Sets the directory name where SOAP extension will put cache files. 1214 | soap.wsdl_cache_dir="/tmp" 1215 | ; (time to live) Sets the number of second while cached file will be used 1216 | ; instead of original one. 1217 | soap.wsdl_cache_ttl=86400 1218 | 1219 | ; Local Variables: 1220 | ; tab-width: 4 1221 | ; End: 1222 | 1223 | <% @directives.sort_by { |key, val| key }.each do |directive, value| -%> 1224 | <%= "#{directive}=#{value}" %> 1225 | <% end -%> 1226 | -------------------------------------------------------------------------------- /test/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | maintainer 'Chef Software, Inc.' 3 | maintainer_email 'cookbooks@chef.io' 4 | license 'Apache-2.0' 5 | description 'Test cookbook for the PHP cookbook' 6 | version '1.0.0' 7 | 8 | depends 'php' 9 | depends 'apt' 10 | depends 'ondrej_ppa_ubuntu' 11 | depends 'yum-epel' 12 | depends 'yum-remi-chef', '>= 5.0.1' 13 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/community.rb: -------------------------------------------------------------------------------- 1 | # Set constants 2 | set_conf_dir = nil 3 | set_conf_dir = if platform_family?('rhel', 'amazon') 4 | '/etc/opt/remi/php80' 5 | else 6 | '/etc/php/8.2' 7 | end 8 | 9 | apt_update 'update' 10 | 11 | # Start of the old community_package recipe --- 12 | if platform_family?('rhel', 'fedora') 13 | include_recipe 'yum-remi-chef::remi' 14 | elsif platform?('ubuntu') 15 | # ondrej no longer supports Ubuntu <20.04 16 | if platform_version.to_i < 20 17 | Chef::Log.fatal 'Skipping run - Ubuntu <20.04 is not supported by the ondrej ppa' 18 | return 19 | end 20 | include_recipe 'ondrej_ppa_ubuntu' 21 | elsif platform?('debian') 22 | # use sury repo for debian (https://deb.sury.org/) 23 | apt_repository 'sury-php' do 24 | uri 'https://packages.sury.org/php/' 25 | key 'https://packages.sury.org/php/apt.gpg' 26 | components %w(main) 27 | end 28 | # Amazon Linux isn't supported by Remi 29 | elsif platform_family?('amazon') 30 | Chef::Log.fatal 'Skipping run - Amazon Linux is not supported by Remi' 31 | return 32 | end 33 | 34 | php_install 'Install PHP from community repo' do 35 | conf_dir set_conf_dir 36 | if platform_family?('rhel', 'amazon') 37 | lib_dir = node['kernel']['machine'] =~ /x86_64/ ? 'lib64' : 'lib' 38 | 39 | packages %w(php80 php80-php-devel php80-php-cli php80-php-xml php80-php-pear) 40 | ext_dir "/opt/remi/php80/root/#{lib_dir}/php/modules" 41 | else 42 | packages %w(php8.2 php8.2-cgi php8.2-cli php8.2-dev php8.2-xml php-pear) 43 | end 44 | end 45 | 46 | # End of old community_package recipe --- 47 | 48 | # README: The Remi repo intentionally avoids installing the binaries to 49 | # the default paths. It comes with a /opt/remi/php80/enable profile 50 | # which can be copied or linked into /etc/profiles.d to auto-load for 51 | # operators in a real cookbook. 52 | if platform_family?('rhel', 'amazon') 53 | link '/usr/bin/php' do 54 | to '/usr/bin/php80' 55 | end 56 | 57 | link '/usr/bin/pear' do 58 | to '/usr/bin/php80-pear' 59 | end 60 | 61 | link '/usr/bin/pecl' do 62 | to '/opt/remi/php80/root/bin/pecl' 63 | end 64 | 65 | link '/etc/profile.d/php80-enable.sh' do 66 | to '/opt/remi/php80/enable' 67 | end 68 | end 69 | 70 | # Create a test pool 71 | php_fpm_pool 'test-pool' do 72 | fpm_ini_control true 73 | if platform_family?('rhel', 'amazon') 74 | service 'php80-php-fpm' 75 | fpm_conf_dir '/etc/opt/remi/php80/php-fpm.d' 76 | listen '/var/run/php-test-fpm.sock' 77 | pool_dir '/etc/opt/remi/php80/php-fpm.d' 78 | fpm_package 'php80-php-fpm' 79 | default_conf '/etc/opt/remi/php80/php-fpm.d/www.conf' 80 | else 81 | service 'php8.2-fpm' 82 | fpm_conf_dir '/etc/php/8.2/fpm' 83 | listen '/var/run/php/php8.2-fpm.sock' 84 | pool_dir '/etc/php/8.2/fpm/pool.d' 85 | fpm_package 'php8.2-fpm' 86 | default_conf '/etc/php/8.2/fpm/pool.d/www.conf' 87 | end 88 | end 89 | 90 | # Add PEAR channel 91 | php_pear_channel 'pear.php.net' do 92 | action :update 93 | end 94 | 95 | # Install https://pear.php.net/package/HTTP2 96 | php_pear 'HTTP2' 97 | 98 | # Add PECL channel 99 | php_pear_channel 'pecl.php.net' do 100 | action :update 101 | end 102 | 103 | # Install https://pecl.php.net/package/sync 104 | php_pear 'sync-binary' do 105 | conf_dir set_conf_dir 106 | if platform_family?('rhel', 'amazon') 107 | ext_conf_dir '/etc/opt/remi/php80/php.d' 108 | else 109 | ext_conf_dir '/etc/php/8.2/mods-available' 110 | end 111 | package_name 'sync' 112 | binary 'pecl' 113 | priority '50' 114 | end 115 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/default.rb: -------------------------------------------------------------------------------- 1 | apt_update 'update' 2 | 3 | php_install 'php' 4 | 5 | # Create a test pool 6 | php_fpm_pool 'test-pool' 7 | 8 | # Add PEAR channel 9 | php_pear_channel 'pear.php.net' do 10 | action :update 11 | end 12 | 13 | # Install https://pear.php.net/package/HTTP2 14 | php_pear 'HTTP2' 15 | 16 | # Add PECL channel 17 | php_pear_channel 'pecl.php.net' do 18 | action :update 19 | end 20 | 21 | # Install https://pecl.php.net/package/sync 22 | pecl_method = node['pecl_method'] || 'binary' 23 | php_pear "sync-#{pecl_method}" do 24 | package_name 'sync' 25 | binary 'pecl' if pecl_method == 'binary' 26 | channel 'pecl.php.net' if pecl_method == 'channel' 27 | priority '50' 28 | end 29 | -------------------------------------------------------------------------------- /test/integration/resource/inspec/php_spec.rb: -------------------------------------------------------------------------------- 1 | describe command('php -v') do 2 | its('exit_status') { should eq 0 } 3 | end 4 | 5 | describe command('pear list-channels') do 6 | its('stdout') { should match(/pear\.php\.net/) } 7 | its('stdout') { should match(/pecl\.php\.net/) } 8 | end 9 | 10 | describe command('php --ri sync') do 11 | its('exit_status') { should eq 0 } 12 | end 13 | 14 | unless os[:family] == 'redhat' || os[:family] == 'fedora' 15 | describe command('php -i') do 16 | its('stdout') { should match(/50-sync/) } 17 | end 18 | 19 | # Check if we didn't accidentally pull in Apache as a dependency (#311) 20 | describe package('apache2') do 21 | it { should_not be_installed } 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/integration/resource_community/inspec/php_spec.rb: -------------------------------------------------------------------------------- 1 | describe command('php -v') do 2 | its('exit_status') { should eq 0 } 3 | its('stdout') { should match(/PHP 8/) } 4 | end 5 | 6 | pear_cmd = os.debian? ? 'pear' : 'php80-pear' 7 | 8 | describe command("#{pear_cmd} list-channels") do 9 | its('stdout') { should match(/pear\.php\.net/) } 10 | its('stdout') { should match(/pecl\.php\.net/) } 11 | end 12 | 13 | describe command('php --ri sync') do 14 | its('exit_status') { should eq 0 } 15 | end 16 | 17 | unless os[:family] == 'redhat' 18 | describe command('php -i') do 19 | its('stdout') { should match(/50-sync/) } 20 | end 21 | 22 | # Check if we didn't accidentally pull in Apache as a dependency (#311) 23 | describe package('apache2') do 24 | it { should_not be_installed } 25 | end 26 | end 27 | --------------------------------------------------------------------------------