├── .codacy.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── elasticsearch ├── provision.sh └── readme.md ├── graphviz ├── README.md └── provision.sh ├── memcached-admin ├── README.md └── provision.sh ├── mongodb ├── README.md ├── mongodb.ini ├── provision.sh ├── server-3.4.asc └── server-4.4.asc ├── nvm ├── README.md └── provision.sh ├── opcache-gui ├── README.md └── provision.sh ├── opcache-status ├── README.md └── provision.sh ├── php ├── provision.sh └── readme.md ├── php56 ├── php5.6-custom.ini ├── php5.6-fpm.conf ├── php5.6-upstream.conf ├── php5.6-www.conf └── provision.sh ├── php70 ├── php7.0-custom.ini ├── php7.0-fpm.conf ├── php7.0-upstream.conf ├── php7.0-www.conf └── provision.sh ├── php71 ├── php7.1-custom.ini ├── php7.1-fpm.conf ├── php7.1-upstream.conf ├── php7.1-www.conf └── provision.sh ├── php72 ├── php7.2-custom.ini ├── php7.2-fpm.conf ├── php7.2-upstream.conf ├── php7.2-www.conf └── provision.sh ├── php73 ├── php7.3-custom.ini ├── php7.3-fpm.conf ├── php7.3-upstream.conf ├── php7.3-www.conf └── provision.sh ├── php74 ├── php7.4-custom.ini ├── php7.4-fpm.conf ├── php7.4-upstream.conf ├── php7.4-www.conf └── provision.sh ├── php80 ├── fpm.conf ├── php-custom.ini ├── provision.sh ├── upstream.conf └── www.conf ├── php81 ├── fpm.conf ├── php-custom.ini ├── provision.sh ├── upstream.conf └── www.conf ├── php82 ├── fpm.conf ├── php-custom.ini ├── provision.sh ├── upstream.conf └── www.conf ├── php83 ├── fpm.conf ├── php-custom.ini ├── provision.sh ├── upstream.conf └── www.conf ├── phpmyadmin ├── README.md ├── config.inc.php └── provision.sh ├── svn-folder-upgrade ├── README.md └── provision.sh ├── tideways ├── by-site.php ├── config.php ├── config.php-profiler.php ├── nginx.conf ├── provision.sh ├── tideways-header.php ├── tideways.ini └── xhgui-php.ini ├── tls-ca ├── README.md ├── openssl-ca.conf ├── openssl-default-cert.conf ├── openssl-site-stub.conf └── provision.sh ├── trusted-hosts ├── README.md ├── hosts.txt └── provision.sh ├── webgrind ├── README.md ├── composer.json └── provision.sh ├── wpcli-dev ├── README.md └── provision.sh └── yarn └── provision.sh /.codacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | engines: 3 | phpcs: 4 | enabled: true 5 | php_version: 8.2 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | webgrind/vendor 2 | webgrind/composer.lock 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to VVV 2 | 3 | Contributions to the VVV project are more than welcome. 4 | 5 | ## License 6 | 7 | By contributing code to the [VVV project](https://github.com/varying-vagrant-vagrants/vvv/) and other sub-projects, you agree to license your contribution under the [MIT License](LICENSE). 8 | 9 | ## Issues 10 | 11 | Issues should be opened on the main [VVV repository](https://github.com/varying-vagrant-vagrants/vvv/). Open a GitHub issue for anything. We've covered quite a bit of ground over time, so it would be helpful to search for related topics first. That said, don't worry if you find yourself opening something that sounds like it could be obvious. There is no such thing. 12 | 13 | ## Comments 14 | 15 | Comment on any GitHub issue, open or closed. The only guidelines here are to be friendly and welcoming. If you see that a question has been asked and you think you know the answer, don't wait! 16 | 17 | ## Pull Requests 18 | 19 | Pull Requests for VVV extensions can be submitted to this repository. Please consider opening an issue on the [VVV repository](https://github.com/varying-vagrant-vagrants/vvv/) first so that we can discuss goals and approach. If you feel more comfortable showing intent with code, then opening a pull request at the same time is more than welcome. 20 | 21 | ## Code Style 22 | 23 | ### Bash Scripting 24 | 25 | For any shell scripting that we do in Bash — see `provision.sh` — we try to follow the style provided in Google's [Shell Style Guide](https://google.github.io/styleguide/shell.xml). 26 | 27 | ### PHP 28 | 29 | For any PHP, we try to follow the WordPress core [code standards](https://make.wordpress.org/core/handbook/coding-standards/). 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2016 the contributors of the VVV project 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VVV Extensions 2 | 3 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/11a6ce9836224f1781d17918d0e0d605)](https://www.codacy.com/gh/Varying-Vagrant-Vagrants/vvv-utilities?utm_source=github.com&utm_medium=referral&utm_content=Varying-Vagrant-Vagrants/vvv-utilities&utm_campaign=Badge_Grade) 4 | 5 | These are optional system level features and software for [VVV](https://github.com/varying-vagrant-vagrants/vvv/), we call them extensions. This repo is the `core` extension, and has a continuous release process, all version of VVV use this git repo. 6 | 7 | Extensions used to be called utilities, but people got confused and kept asking for extensions. 8 | 9 | Here is how you might use this utility to install software in `config/config.yml`: 10 | 11 | ```yaml 12 | extensions: 13 | core: # The core VVV utility 14 | - tls-ca # HTTPS SSL/TLS certificates 15 | - phpmyadmin # Web based database client 16 | - php83 # PHP Version 8.3 17 | ``` 18 | 19 | Each item is the name of a folder, in the above example, adding `php83` means that VVV will run the `php83/provision.sh` script when provisioning. Likewise if you added a `banana/provision.sh` and listed ` - banana` in `config/config.yml`, then `banana/provision.sh` would run on the next provision. 20 | 21 | For more information about extensions and how to create your own, [read our extensions chapter on the documentation site](https://varyingvagrantvagrants.org/docs/en-US/utilities/). 22 | -------------------------------------------------------------------------------- /elasticsearch/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export DEBIAN_FRONTEND=noninteractive 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | 7 | # @TODO: retrieve major version from config.yml 8 | ESMAJORVERSION="7" 9 | 10 | elastic_apt_package_install_list=( 11 | "apt-transport-https" 12 | "openjdk-11-jre" 13 | "elasticsearch" 14 | ) 15 | 16 | ### FUNCTIONS 17 | 18 | package_install() { 19 | 20 | echo " * Installing Elastic Search v${ESMAJORVERSION}." 21 | echo " - Note: To change versions you need to manually uninstall elastic before reprovisioning" 22 | 23 | if [[ ! $( apt-key list | grep 'Elasticsearch') ]]; then 24 | echo " * Adding Elastic GPG Apt key" 25 | wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add - 26 | fi 27 | echo " * Adding apt source https://artifacts.elastic.co/packages/${ESMAJORVERSION}.x/apt stable main" 28 | echo "deb https://artifacts.elastic.co/packages/${ESMAJORVERSION}.x/apt stable main" | sudo tee "/etc/apt/sources.list.d/vvv-elastic.list" 29 | 30 | # Update all of the package references before installing anything 31 | echo " * Running apt-get update..." 32 | apt-get -y update 33 | 34 | # Install required packages 35 | echo " * Installing apt-get packages..." 36 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${elastic_apt_package_install_list[@]}; then 37 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 38 | apt-get clean 39 | return 1 40 | fi 41 | 42 | # Remove unnecessary packages 43 | echo " * Removing unnecessary packages..." 44 | apt-get autoremove -y 45 | 46 | # Clean up apt caches 47 | echo " * Cleaning apt caches..." 48 | apt-get clean 49 | 50 | sudo update-rc.d elasticsearch defaults 95 10 51 | 52 | return 0 53 | } 54 | 55 | package_install 56 | echo " * Restarting Elastic Search" 57 | sudo service "elasticsearch" restart 58 | echo " * Elastic Search restarted" 59 | -------------------------------------------------------------------------------- /elasticsearch/readme.md: -------------------------------------------------------------------------------- 1 | # ElasticSearch 2 | 3 | Installs Elastic search v7, in the future it will use a version parameter in `config.yml`. 4 | 5 | To use this, install Elasticpress in your WordPress site after enabling and reprovisioning. Elasticpress should prefix your sites indexes so that they don't conflict with other VVV sites. 6 | -------------------------------------------------------------------------------- /graphviz/README.md: -------------------------------------------------------------------------------- 1 | # Graphviz 2 | 3 | Graphviz is open source graph visualization software. Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. It has important applications in networking, bioinformatics, software engineering, database and web design, machine learning, and in visual interfaces for other technical domains. 4 | 5 | More info at [https://graphviz.org/](https://graphviz.org/) 6 | -------------------------------------------------------------------------------- /graphviz/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | 4 | if ! [ -x "$(command -v dot)" ]; then 5 | 6 | apt_package_install_list=( 7 | graphviz 8 | ) 9 | 10 | # Install required packages 11 | echo " * Installing graphviz apt-get packages..." 12 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 13 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 14 | apt-get clean 15 | return 1 16 | fi 17 | 18 | echo " * symlinking dot" 19 | ln -sf "/usr/bin/dot" "/usr/local/bin/dot" 20 | 21 | echo " * graphviz provisioned" 22 | else 23 | echo " * graphviz already installed" 24 | fi 25 | -------------------------------------------------------------------------------- /memcached-admin/README.md: -------------------------------------------------------------------------------- 1 | # phpMemcachedAdmin 2 | 3 | Graphic stand-alone administration for memcached to monitor and debug. 4 | 5 | [https://github.com/wp-cloud/phpmemcacheadmin](https://github.com/wp-cloud/phpmemcacheadmin) 6 | -------------------------------------------------------------------------------- /memcached-admin/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Download and extract phpMemcachedAdmin to provide a dashboard view and 4 | # admin interface to the goings on of memcached when running 5 | echo " * Checking for memcached-admin" 6 | if [[ ! -d "/srv/www/default/memcached-admin" ]]; then 7 | echo -e " * Downloading phpMemcachedAdmin, see https://github.com/elijaa/phpmemcachedadmin" 8 | cd /srv/www/default || return 1 9 | wget -q -O phpmemcachedadmin.tar.gz "https://github.com/wp-cloud/phpmemcacheadmin/archive/1.2.4-vvv.tar.gz" 10 | tar -xf phpmemcachedadmin.tar.gz 11 | mv phpmemcacheadmin* memcached-admin 12 | cp memcached-admin/Config/Memcache.sample.php memcached-admin/Config/Memcache.php 13 | rm phpmemcachedadmin.tar.gz 14 | else 15 | echo " * phpMemcachedAdmin already installed." 16 | fi 17 | -------------------------------------------------------------------------------- /mongodb/README.md: -------------------------------------------------------------------------------- 1 | # MongoDB 2 | 3 | Installs MongoDB v4 and the PHP mongoDB extension 4 | -------------------------------------------------------------------------------- /mongodb/mongodb.ini: -------------------------------------------------------------------------------- 1 | extension=mongodb.so 2 | -------------------------------------------------------------------------------- /mongodb/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Mongodb 3 | export DEBIAN_FRONTEND=noninteractive 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | install_mongodb_php() { 7 | for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" 8 | do 9 | if [[ $(command -v php$version) ]]; then 10 | echo " * Checking MongoDB for PHP ${version}" 11 | if [ -e "/etc/php/${version}/mods-available/mongodb.ini" ]; then 12 | echo " * MongoDB PHP v${version} extension is already installed" 13 | else 14 | echo " * Installing MongoDB for PHP ${version}" 15 | sudo pecl -d php_suffix="$version" install mongodb > /dev/null 2>&1 16 | # do not remove files, only register the packages as not installed so we can install for other php version 17 | sudo pecl uninstall -r mongodb > /dev/null 2>&1 18 | cp -f "${DIR}/mongodb.ini" "/etc/php/${version}/mods-available/mongodb.ini" 19 | phpenmod -v "${version}" mongodb 20 | echo " * Installed PHP v${version} MongoDB driver" 21 | fi 22 | fi 23 | done 24 | } 25 | 26 | install_mongodb() { 27 | echo " * Installing MongoDB" 28 | codename=$(lsb_release --codename | cut -f2) 29 | if [[ $codename == "trusty" ]]; then 30 | if [[ ! $( apt-key list | grep 'MongoDB 3.4') ]]; then 31 | apt-key add "${DIR}/server-3.4.asc" 32 | fi 33 | echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list 34 | else 35 | [ -e /etc/apt/sources.list.d/mongodb-org-3.4.list ] && rm /etc/apt/sources.list.d/mongodb-org-3.4.list 36 | [ -e /etc/apt/sources.list.d/mongodb-org-4.0.list ] && rm /etc/apt/sources.list.d/mongodb-org-4.0.list 37 | if [[ $( apt-key list | grep '2069 1EEC 3521 6C63 CAF6 6CE1 6564 08E3 90CF B1F5') ]]; then 38 | apt-key del '2069 1EEC 3521 6C63 CAF6 6CE1 6564 08E3 90CF B1F5' 39 | fi 40 | if [[ ! $( apt-key list | grep 'MongoDB 4.4') ]]; then 41 | apt-key add "${DIR}/server-4.4.asc" 42 | fi 43 | echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu ${codename}/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org.list 44 | fi 45 | 46 | echo " * Running apt-get update" 47 | apt-get -y update 48 | echo " * Installing apt-get packages" 49 | apt_package_install_list=( 50 | mongodb-org 51 | re2c 52 | ) 53 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 54 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 55 | apt-get clean 56 | return 1 57 | fi 58 | } 59 | 60 | cleanup_mongodb_entries() { 61 | echo " * Auto-removing mongoDB records older than 2592000 seconds (30 days)" 62 | mongo xhprof --eval 'db.collection.ensureIndex( { "meta.request_ts" : 1 }, { expireAfterSeconds : 2592000 } )' > /dev/null 2>&1 63 | # indexes 64 | mongo xhprof --eval "db.collection.ensureIndex( { 'meta.SERVER.REQUEST_TIME' : -1 } )" 65 | mongo xhprof --eval "db.collection.ensureIndex( { 'profile.main().wt' : -1 } )" 66 | mongo xhprof --eval "db.collection.ensureIndex( { 'profile.main().mu' : -1 } )" 67 | mongo xhprof --eval "db.collection.ensureIndex( { 'profile.main().cpu' : -1 } )" 68 | mongo xhprof --eval "db.collection.ensureIndex( { 'meta.url' : 1 } )" 69 | } 70 | 71 | # Create the log and data directories if they don't exist already 72 | mkdir -p /var/log/mongodb 73 | mkdir -p /data/db 74 | 75 | echo " * Making sure mongodb service is enabled" 76 | 77 | if [[ ! $(command -v mongo) ]]; then 78 | install_mongodb 79 | fi 80 | install_mongodb_php 81 | cleanup_mongodb_entries 82 | 83 | # make sure mongo can actually write to the log folder 84 | chown mongodb /var/log/mongodb 85 | 86 | echo " * Restarting mongod" 87 | systemctl enable mongod.service 88 | systemctl start mongod.service 89 | 90 | echo " * MongoDB provisioning complete" 91 | -------------------------------------------------------------------------------- /mongodb/server-3.4.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1 3 | 4 | mQINBFaUNhsBEACkTlpL9xCrlirl77tahFzzd9ccTc5wP+M3oob18GIaMYKicjbR 5 | h6J6ytCiXCkl65zYKvQdLkt8qlkBVc5DxGeJvD41IY3NzGPz+BZ9pFFBndAE+JEP 6 | ng0ULLxzUDmWXIoukdHqf92BSizTFd2A8v+YGuwOkNBdPi/BHkwiViAaAKDZm/4k 7 | 9LZeOF0v7gZF89QD75NrSCKo5SGFRb8Cxi4KR4cS/jPuQVjd+B9fWkc74BUWE91t 8 | 3R87Uypd+1qnmoN6cOssLZ4s8n/cyOCkVphGmk1tDDhbEsI4knOqtPXaBHiC4lVI 9 | ghpTHEDUuDfbQ7scySae8/YItTC/vVGngiJmZSfZU5AvVspe6rfkHQHqZs3gYMqj 10 | XPl7acviEAZ7OiMp9diq6Kgp+xLRvRGL+jtUjLkP5O4gJlnxCm7YWrYfYA/vHULD 11 | MyIGSBzuESGxL+Ygz+Dc0Aim9NPM5KhpV5FoAXNt50cn6n1adIwbUciRY0zBXKAI 12 | Vj6D+j3e0ozsO+GGEpmQFAIo1h7CEn8VV61WaLz2F60LKR8d/DEMZ7SY8uznbzkm 13 | TJCeCp/pTnPeGwkyJmJ78LAaKw2tSCeEAfRlnzPeQeanOnEX/wnAjHHAHewvGgQe 14 | GW1QkEdy8zNmfODDf9wqknBShaFRHAOAQFEgBAkYHuT4SgHqW8TVDtF3CQARAQAB 15 | tDdNb25nb0RCIDMuNCBSZWxlYXNlIFNpZ25pbmcgS2V5IDxwYWNrYWdpbmdAbW9u 16 | Z29kYi5jb20+iQI+BBMBAgAoAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUC 17 | Wk/J/wUJB336sAAKCRC8cR+boVcDxt2eEACgo6SOokDP4fZujOAyWIrmPMbb160u 18 | KKk5Pf1H2KPMxiG5Uih90AigfLkReuCPqZLFA6cECfpc32K9Y9gZAby0TusuiQYR 19 | 7Mavf4XfTQRqVHK7/Vhxm3uQMNND5+ntyCUnDbjww0EtDgcS43Q33cSdVfZSLJ8P 20 | ObjqPcqHMyKetkBfKJA9PjZMol4m0wub3HfF1K68/FxpCF8fqely5sGe/uFOSpZZ 21 | ndhyJW2L4lkgAYZEo+YByTv9w5jLL1BwESsoXkBmvWSeKMrQlJ+lt4BCd9cM0gMO 22 | umYcor3WWjXILmjV8M28/7EGkbszESSTZ9wRhYS+Z7J3dRNjuNrM949cqKgo01T5 23 | NtA7aViGlE1mY2NSzTsvHLVsyDCV53qbuycbl/zHKg/3CrMg3WZC6nS04mHUt7rG 24 | jXdLCIb6Sr+wvM2/3/jbMtsdwyoWyNJq8UdULoEjiRTGGRaIp056GG3IwdJ6h1N8 25 | 64E+qbcNlVgyG/UeViNM3t9DtnGY/JceRCyRFU6nWcIF/zIiQ2tpBWI4gtE2KuFo 26 | ptUYn7P+c9Tie8a+agLDYd0hluasDBCG73693Rpt9mXcEkx5LrHN3QPPke6NaJUa 27 | W9PiWQhJZFE+LVg1OfKPvNAw3m6a9O6ZiEmTlRx5Rvn7Ueqmlxv5D11FKvEuvDZM 28 | 7Pfbg0QYmHaaRQ== 29 | =ReBm 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /mongodb/server-4.4.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: GnuPG v1 3 | 4 | mQINBFzteqwBEADSirbLWsjgkQmdWr06jXPN8049MCqXQIZ2ovy9uJPyLkHgOCta 5 | 8dmX+8Fkk5yNOLScjB1HUGJxAWJG+AhldW1xQGeo6loDfTW1mlfetq/zpW7CKbUp 6 | qve9eYYulneAy/81M/UoUZSzHqj6XY39wzJCH20H+Qx3WwcqXgSU7fSFXyJ4EBYs 7 | kWybbrAra5v29LUTBd7OvvS+Swovdh4T31YijUOUUL/gJkBI9UneVyV7/8DdUoVJ 8 | a8ym2pZ6ALy+GZrWBHcCKD/rQjEkXJnDglu+FSUI50SzaC9YX31TTzEMJijiPi6I 9 | MIZJMXLH7GpCIDcvyrLWIRYVJAQRoYJB4rmp42HTyed4eg4RnSiFrxVV5xQaDnSl 10 | /8zSOdVMBVewp8ipv34VeRXgNTgRkhA2JmL+KlALMkPo7MbRkJF01DiOOsIdz3Iu 11 | 43oYg3QYmqxZI6kZNtXpUMnJeuRmMQJJN8yc9ZdOA9Ll2TTcIql8XEsjGcM7IWM9 12 | CP6zGwCcbrv72Ka+h/bGaLpwLbpkr5I8PjjSECn9fBcgnVX6HfKH7u3y11+Va1nh 13 | a8ZEE1TuOqRxnVDQ+K4iwaZFgFYsBMKo2ghoU2ZbZxu14vs6Eksn6UFsm8DpPwfy 14 | jtLtdje8jrbYAqAy5zIMLoW+I6Rb5sU3Olh9nI7NW4T5qQeemBcuRAwB4QARAQAB 15 | tDdNb25nb0RCIDQuNCBSZWxlYXNlIFNpZ25pbmcgS2V5IDxwYWNrYWdpbmdAbW9u 16 | Z29kYi5jb20+iQI+BBMBAgAoAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAUC 17 | ZlOWFQUJDwm12wAKCRBlZAjjkM+x9TEeD/sHGMIXB6W74JMSMGN+MAfPT5Ti8QvV 18 | QXWmkqn1OhjFGoD+9ET08+8Dx2qX5xgs1tETe/U+oD+Ehe83alFWkqM3IeGinEHg 19 | R4DThL6tBQWVVaGFUicuXawJYLRPiKhUy+n9+WZ1tsBBFLkSOfCW5I2u1LBfrmhR 20 | vLcK2NO4qgnW3Zi7OI8AhkCD34tw7jsYT40fXJRjOqATd9auHsq9CD6NNfmBLT+T 21 | CPn4M1UON5Fyp0yhu+byyFiUy4fZzT6GjPcJ8xFGjNRSpnw1XkGKGQWBjvxgmiWq 22 | I9U0I1WAJwuWL+A4ZqiofRM0Oe7/skhF9RXL89OW6sTKdDOKLYU/+wylmvSpior7 23 | RjGAEbb9oCwQgKwnz3GF1to3w2IvWP0drMXJpf7EncaWlrqKjLgyPJ03cngCULpV 24 | asMxpfb1au/+eOi6o4yAJs2bLVS41hdQ2FYGaA+RIbrewmOEUHCc8SkdJ2ldCdtn 25 | gmBsoGybtEIINXpntD80X561H9fFVRvkmWxU+KjRDUbtKzxG0a1RRYjY2tym8N0y 26 | PA05I/+YPiIIoVBvWZUkIuM3b259ud+pdElgd087kBKCaQIHOXxwKvgfJTHB9VJT 27 | oaeRQZxPGcE73FHOs27ZAQuHKoCRjCzfo4DRzziylffAoeQeuhOolhttHQCUxicp 28 | 6Nub/4IW4HxCMA== 29 | =UYzW 30 | -----END PGP PUBLIC KEY BLOCK----- 31 | -------------------------------------------------------------------------------- /nvm/README.md: -------------------------------------------------------------------------------- 1 | # Node Version Manager 2 | 3 | `nvm` is a version manager for [node.js](https://nodejs.org/en/), designed to be installed per-user, and invoked per-shell. `nvm` works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL. 4 | 5 | See full documentation here: [https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm) 6 | 7 | **This VVV utility will install `nvm` and set default version to the one that VVV installs.** 8 | 9 | ## Usage 10 | 11 | To download, compile, and install the latest release of node, do this: 12 | 13 | ```bash 14 | nvm install node # "node" is an alias for the latest version 15 | ``` 16 | 17 | You can list available versions using `ls-remote`: 18 | 19 | ```bash 20 | nvm ls-remote 21 | ``` 22 | 23 | To install a specific version of node: 24 | 25 | ```bash 26 | nvm install 6.14.4 # or 10.10.0, 8.9.1, etc 27 | ``` 28 | 29 | If you want to see what versions are installed: 30 | 31 | ```bash 32 | nvm ls 33 | ``` 34 | -------------------------------------------------------------------------------- /nvm/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # NVM install to facilitate multiple versions of Nodejs 4 | # Makes it easier to install new versions of Nodejs and 5 | # to work with multiple projects that need different 6 | # versions of Nodejs 7 | 8 | echo " * Checking for NVM" 9 | 10 | export NVM_DIR="/home/vagrant/.nvm" 11 | 12 | echo " !! NVM is a part of VVV core as of v3.9, you should remove nvm from your extensions in config.yml !!" 13 | 14 | if [[ -d "${NVM_DIR}" && -f "${NVM_DIR}/nvm.sh" ]] 15 | then 16 | echo " ✓ NVM is already installed, checking for updates" 17 | ( 18 | cd "$NVM_DIR" 19 | noroot git fetch --tags origin 20 | noroot git checkout `noroot git describe --abbrev=0 --tags --match "v[0-9]*" $(noroot git rev-list --tags --max-count=1)` 21 | ) && \. "$NVM_DIR/nvm.sh" 22 | else 23 | if [[ -d "${NVMFOLDER}" && ! -f "${NVMFOLDER}/nvm.sh" ]] 24 | then 25 | # Possible remnants or something messed 26 | # up NVM install making it unusable 27 | echo " * NVM found in an unusable state, removing it completely" 28 | rm -rf "${NVM_DIR}" 29 | fi 30 | 31 | echo " * Installing NVM via git" 32 | ( 33 | noroot git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR" 34 | cd "${NVM_DIR}" 35 | noroot git checkout `noroot git describe --abbrev=0 --tags --match "v[0-9]*" $(noroot git rev-list --tags --max-count=1)` 36 | ) && \. "${NVM_DIR}/nvm.sh" 37 | echo " ✓ NVM installed" 38 | 39 | echo 'export NVM_DIR="$HOME/.nvm"' >> /home/vagrant/.bashrc 40 | echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> /home/vagrant/.bashrc 41 | echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> /home/vagrant/.bashrc 42 | fi 43 | -------------------------------------------------------------------------------- /opcache-gui/README.md: -------------------------------------------------------------------------------- 1 | # OPcache GUI 2 | 3 | A clean and responsive interface for Zend OPcache information, showing statistics, settings and cached files, and providing a real-time update for the information. 4 | 5 | [https://github.com/amnuts/opcache-gui](https://github.com/amnuts/opcache-gui) 6 | -------------------------------------------------------------------------------- /opcache-gui/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Checkout Opcache GUI to provide a dashboard for viewing statistics 3 | 4 | noroot mkdir -p /srv/www/default/opcache-gui 5 | echo -e " * Provisioning Opcache GUI" 6 | cd /srv/www/default/opcache-gui || return 1 7 | noroot composer require amnuts/opcache-gui 8 | 9 | echo " * symlinking index.php" 10 | 11 | noroot ln -sf ./vendor/amnuts/opcache-gui/index.php ./index.php 12 | 13 | echo " * Opcache GUI complete" 14 | -------------------------------------------------------------------------------- /opcache-status/README.md: -------------------------------------------------------------------------------- 1 | # OPcache Status 2 | 3 | A one-page opcache status page for the PHP 5.5 opcode cache. 4 | 5 | [https://github.com/rlerdorf/opcache-status](https://github.com/rlerdorf/opcache-status) 6 | -------------------------------------------------------------------------------- /opcache-status/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Checkout Opcache Status to provide a dashboard for viewing statistics 3 | # about PHP's built in opcache. 4 | 5 | echo -e " ! Opcache Status is abandoned, please switch to the new VVV utility opcache-gui in config.yml" 6 | 7 | if [[ ! -d "/srv/www/default/opcache-status" ]]; then 8 | echo -e " * Downloading Opcache Status, see https://github.com/rlerdorf/opcache-status/" 9 | cd /srv/www/default || return 1 10 | noroot git clone "https://github.com/rlerdorf/opcache-status.git" opcache-status 11 | else 12 | echo -e " * Updating Opcache Status" 13 | cd /srv/www/default/opcache-status || return 1 14 | noroot git pull --rebase origin master 15 | fi 16 | -------------------------------------------------------------------------------- /php/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export DEBIAN_FRONTEND=noninteractive 4 | 5 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 6 | 7 | echo " * Running all PHP provisioners" 8 | 9 | ( cd "${DIR}/../php56/" && . provision.sh ) 10 | ( cd "${DIR}/../php70/" && . provision.sh ) 11 | ( cd "${DIR}/../php71/" && . provision.sh ) 12 | ( cd "${DIR}/../php72/" && . provision.sh ) 13 | ( cd "${DIR}/../php73/" && . provision.sh ) 14 | ( cd "${DIR}/../php74/" && . provision.sh ) 15 | ( cd "${DIR}/../php80/" && . provision.sh ) 16 | ( cd "${DIR}/../php81/" && . provision.sh ) 17 | ( cd "${DIR}/../php82/" && . provision.sh ) 18 | ( cd "${DIR}/../php83/" && . provision.sh ) 19 | 20 | echo " * Finished running PHP provisioners" 21 | -------------------------------------------------------------------------------- /php/readme.md: -------------------------------------------------------------------------------- 1 | # All PHP Versions Extension 2 | 3 | ## What Does it Do? 4 | This extension installs every PHP version available. It saves typing out `php81` and `php82` etc etc in `config.yml` or having to add new entries when new versions come out. 5 | 6 | This does mean though that provisioning will take longer as it installs _all_ the versions which takes time. 7 | 8 | ## How Do I Remove or Exclude a Version? 9 | 10 | You don't/can't. 11 | 12 | Warning: Removing this won't uninstall those versions, extensions add things, they don't remove them. 13 | 14 | If you used this and no longer need the other PHP versions, you'd have to: 15 | 16 | 1. Back up your databases. 17 | 2. Destroy the VVV instance with `vagrant destroy`. 18 | 3. Remove this extension from `config.yml`. 19 | 4. Then recreate your VVV instance. 20 | 5. Restore the database back ups you made. 21 | 22 | ## How to Modify PHP Configs 23 | 24 | **TLDR: Don't modify the php.ini for a version, add your own ini files!** 25 | 26 | Each version has its own folder and you might be tempted ot modify the `php.ini` but this is a mistake! Now the extensions won't update and your changes might get overwritten on provision! 27 | 28 | Add your own `.ini` file to the folders with a new name and it will be included without causing issues. 29 | -------------------------------------------------------------------------------- /php56/php5.6-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php5.6_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php56/php5.6-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/5.6/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php5.6-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php5.6-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/5.6/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php56/php5.6-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php56 { 3 | server unix:/var/run/php5.6-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php56/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="5.6" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-ssh2" 28 | "php${PHPVERSION}-xdebug" 29 | "php${PHPVERSION}-bcmath" 30 | "php${PHPVERSION}-curl" 31 | "php${PHPVERSION}-gd" 32 | "php${PHPVERSION}-intl" 33 | "php${PHPVERSION}-mbstring" 34 | "php${PHPVERSION}-mysql" 35 | "php${PHPVERSION}-imap" 36 | "php${PHPVERSION}-json" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | package_install() { 44 | # Update all of the package references before installing anything 45 | echo " * Running apt-get update..." 46 | apt-get -y update 47 | 48 | # Install required packages 49 | echo " * Installing apt-get packages..." 50 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 51 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 52 | apt-get clean 53 | return 1 54 | fi 55 | 56 | # Remove unnecessary packages 57 | echo " * Removing unnecessary packages..." 58 | apt-get autoremove -y 59 | 60 | # Clean up apt caches 61 | echo " * Cleaning apt caches..." 62 | apt-get clean 63 | 64 | return 0 65 | } 66 | 67 | configure() { 68 | # Copy nginx configuration from local 69 | cp -f "${DIR}/php${PHPVERSION}-upstream.conf" "/etc/nginx/upstreams/php56.conf" 70 | echo " * Copied ${DIR}/php${PHPVERSION}-upstream.conf to /etc/nginx/upstreams/php56.conf" 71 | 72 | # Copy php-fpm configuration from local 73 | cp -f "${DIR}/php${PHPVERSION}-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 74 | echo " * Copied ${DIR}/php${PHPVERSION}-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 75 | 76 | cp -f "${DIR}/php${PHPVERSION}-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 77 | echo " * Copied ${DIR}/php${PHPVERSION}-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 78 | 79 | cp -f "${DIR}/php${PHPVERSION}-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 80 | echo " * Copied ${DIR}/php${PHPVERSION}-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 81 | 82 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 83 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 84 | 85 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 86 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 87 | 88 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 89 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 90 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 91 | 92 | fi 93 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 94 | cp "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 95 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 96 | fi 97 | 98 | echo " * Restarting php${PHPVERSION}-fpm service" 99 | service "php${PHPVERSION}-fpm" restart 100 | } 101 | 102 | package_install 103 | configure 104 | 105 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 106 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 107 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 108 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 109 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 110 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 111 | 112 | echo " * PHP ${PHPVERSION} provisioning complete" 113 | -------------------------------------------------------------------------------- /php70/php7.0-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php7.0_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php70/php7.0-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/7.0/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php7.0-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php7.0-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/7.0/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php70/php7.0-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php70 { 3 | server unix:/var/run/php7.0-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php70/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="7.0" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-ssh2" 28 | "php${PHPVERSION}-xdebug" 29 | "php${PHPVERSION}-bcmath" 30 | "php${PHPVERSION}-curl" 31 | "php${PHPVERSION}-gd" 32 | "php${PHPVERSION}-intl" 33 | "php${PHPVERSION}-mbstring" 34 | "php${PHPVERSION}-mysql" 35 | "php${PHPVERSION}-imap" 36 | "php${PHPVERSION}-json" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo "Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp "${DIR}/php7.0-upstream.conf" "/etc/nginx/upstreams/php70.conf" 72 | echo " * Copied ${DIR}/php7.0-upstream.conf to /etc/nginx/upstreams/php70.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/php7.0-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/php7.0-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/php7.0-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/php7.0-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php7.0-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php7.0-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP 7.0 provisioning complete" 115 | -------------------------------------------------------------------------------- /php71/php7.1-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php7.1_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php71/php7.1-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/7.1/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php7.1-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php7.1-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/7.1/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php71/php7.1-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php71 { 3 | server unix:/var/run/php7.1-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php71/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="7.1" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-json" 38 | "php${PHPVERSION}-soap" 39 | "php${PHPVERSION}-xml" 40 | "php${PHPVERSION}-zip" 41 | ) 42 | 43 | ### FUNCTIONS 44 | 45 | package_install() { 46 | 47 | # Update all of the package references before installing anything 48 | echo " * Running apt-get update..." 49 | apt-get -y update 50 | 51 | # Install required packages 52 | echo " * Installing apt-get packages..." 53 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 54 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 55 | apt-get clean 56 | return 1 57 | fi 58 | 59 | # Remove unnecessary packages 60 | echo " * Removing unnecessary packages..." 61 | apt-get autoremove -y 62 | 63 | # Clean up apt caches 64 | echo " * Cleaning apt caches..." 65 | apt-get clean 66 | 67 | return 0 68 | } 69 | 70 | configure() { 71 | # Copy nginx configuration from local 72 | cp -f "${DIR}/php7.1-upstream.conf" "/etc/nginx/upstreams/php71.conf" 73 | echo " * Copied ${DIR}/php7.1-upstream.conf to /etc/nginx/upstreams/php71.conf" 74 | 75 | # Copy php-fpm configuration from local 76 | cp -f "${DIR}/php7.1-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | echo " * Copied ${DIR}/php7.1-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 78 | 79 | cp -f "${DIR}/php7.1-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | echo " * Copied ${DIR}/php7.1-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 81 | 82 | cp -f "${DIR}/php7.1-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | echo " * Copied ${DIR}/php7.1-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 84 | 85 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 87 | 88 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 90 | 91 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 92 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 94 | 95 | fi 96 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 97 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 99 | fi 100 | 101 | echo " * Restarting php${PHPVERSION}-fpm service " 102 | service "php${PHPVERSION}-fpm" restart 103 | } 104 | 105 | package_install 106 | configure 107 | 108 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 109 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 110 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 111 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 112 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 113 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 114 | 115 | echo "PHP 7.1 provisioning complete" 116 | -------------------------------------------------------------------------------- /php72/php7.2-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php7.2_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php72/php7.2-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/7.2/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php7.2-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php7.2-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/7.2/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php72/php7.2-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php72 { 3 | server unix:/var/run/php7.2-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php72/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="7.2" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-json" 38 | "php${PHPVERSION}-soap" 39 | "php${PHPVERSION}-xml" 40 | "php${PHPVERSION}-zip" 41 | ) 42 | 43 | ### FUNCTIONS 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp -f "${DIR}/php7.2-upstream.conf" "/etc/nginx/upstreams/php72.conf" 72 | echo " * Copied ${DIR}/php7.2-upstream.conf to /etc/nginx/upstreams/php72.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/php7.2-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/php7.2-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/php7.2-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/php7.2-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php7.2-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php7.2-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP 7.2 provisioning complete" 115 | -------------------------------------------------------------------------------- /php73/php7.3-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php7.3_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php73/php7.3-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/7.3/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php7.3-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php7.3-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/7.3/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php73/php7.3-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php73 { 3 | server unix:/var/run/php7.3-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php73/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="7.3" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-json" 38 | "php${PHPVERSION}-soap" 39 | "php${PHPVERSION}-xml" 40 | "php${PHPVERSION}-zip" 41 | ) 42 | 43 | ### FUNCTIONS 44 | 45 | package_install() { 46 | 47 | # Update all of the package references before installing anything 48 | echo " * Running apt-get update..." 49 | apt-get -y update 50 | 51 | # Install required packages 52 | echo " * Installing apt-get packages..." 53 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 54 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 55 | apt-get clean 56 | return 1 57 | fi 58 | 59 | # Remove unnecessary packages 60 | echo " * Removing unnecessary packages..." 61 | apt-get autoremove -y 62 | 63 | # Clean up apt caches 64 | echo " * Cleaning apt caches..." 65 | apt-get clean 66 | 67 | return 0 68 | } 69 | 70 | configure() { 71 | # Copy nginx configuration from local 72 | cp -f "${DIR}/php7.3-upstream.conf" "/etc/nginx/upstreams/php73.conf" 73 | echo " * Copied ${DIR}/php7.3-upstream.conf to /etc/nginx/upstreams/php73.conf" 74 | 75 | # Copy php-fpm configuration from local 76 | cp -f "${DIR}/php7.3-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | echo " * Copied ${DIR}/php7.3-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 78 | 79 | cp -f "${DIR}/php7.3-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | echo " * Copied ${DIR}/php7.3-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 81 | 82 | cp -f "${DIR}/php7.3-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | echo " * Copied ${DIR}/php7.3-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 84 | 85 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 87 | 88 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 90 | 91 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 92 | cp "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 94 | 95 | fi 96 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 97 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 99 | fi 100 | 101 | echo " * Restarting php${PHPVERSION}-fpm service " 102 | service "php${PHPVERSION}-fpm" restart 103 | } 104 | 105 | package_install 106 | configure 107 | 108 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 109 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 110 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 111 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 112 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 113 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 114 | 115 | echo " * PHP 7.3 provisioning complete" 116 | -------------------------------------------------------------------------------- /php74/php7.4-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php7.4_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php74/php7.4-fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/7.4/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php7.4-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php7.4-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/7.4/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php74/php7.4-upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php74 { 3 | server unix:/var/run/php7.4-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php74/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="7.4" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-json" 38 | "php${PHPVERSION}-soap" 39 | "php${PHPVERSION}-xml" 40 | "php${PHPVERSION}-zip" 41 | ) 42 | 43 | ### FUNCTIONS 44 | 45 | package_install() { 46 | 47 | # Update all of the package references before installing anything 48 | echo " * Running apt-get update..." 49 | apt-get -y update 50 | 51 | # Install required packages 52 | echo " * Installing apt-get packages..." 53 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 54 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 55 | apt-get clean 56 | return 1 57 | fi 58 | 59 | # Remove unnecessary packages 60 | echo " * Removing unnecessary packages..." 61 | apt-get autoremove -y 62 | 63 | # Clean up apt caches 64 | echo " * Cleaning apt caches..." 65 | apt-get clean 66 | 67 | return 0 68 | } 69 | 70 | configure() { 71 | # Copy nginx configuration from local 72 | cp -f "${DIR}/php${PHPVERSION}-upstream.conf" "/etc/nginx/upstreams/php74.conf" 73 | echo " * Copied ${DIR}/php${PHPVERSION}-upstream.conf to /etc/nginx/upstreams/php74.conf" 74 | 75 | # Copy php-fpm configuration from local 76 | cp -f "${DIR}/php${PHPVERSION}-fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | echo " * Copied ${DIR}/php${PHPVERSION}-fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 78 | 79 | cp -f "${DIR}/php${PHPVERSION}-www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | echo " * Copied ${DIR}/php${PHPVERSION}-www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 81 | 82 | cp -f "${DIR}/php${PHPVERSION}-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | echo " * Copied ${DIR}/php${PHPVERSION}-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 84 | 85 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 87 | 88 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 90 | 91 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 92 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 94 | 95 | fi 96 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 97 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 99 | fi 100 | 101 | echo " * Restarting php${PHPVERSION}-fpm service " 102 | service "php${PHPVERSION}-fpm" restart 103 | } 104 | 105 | package_install 106 | configure 107 | 108 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 109 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 110 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 111 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 112 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 113 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 114 | 115 | echo " * PHP ${PHPVERSION} provisioning complete" 116 | -------------------------------------------------------------------------------- /php80/fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/8.0/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php8.0-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php8.0-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/8.0/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php80/php-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php8.0_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php80/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="8.0" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.0. As long as php8.0-fpm and php8.0-cli are 14 | # installed, there is no need to install the general php8.0 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp -f "${DIR}/upstream.conf" "/etc/nginx/upstreams/php80.conf" 72 | echo " * Copied ${DIR}/upstream.conf to /etc/nginx/upstreams/php80.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP ${PHPVERSION} provisioning complete" 115 | -------------------------------------------------------------------------------- /php80/upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php80 { 3 | server unix:/var/run/php8.0-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php80/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'slowlog' 9 | ; - 'listen' (unixsocket) 10 | ; - 'chroot' 11 | ; - 'chdir' 12 | ; - 'php_values' 13 | ; - 'php_admin_values' 14 | ; When not set, the global prefix (or /usr) applies instead. 15 | ; Note: This directive can also be relative to the global prefix. 16 | ; Default Value: none 17 | ;prefix = /path/to/pools/$pool 18 | 19 | ; Unix user/group of processes 20 | ; Note: The user is mandatory. If the group is not set, the default user's group 21 | ; will be used. 22 | user = www-data 23 | group = www-data 24 | 25 | ; The address on which to accept FastCGI requests. 26 | ; Valid syntaxes are: 27 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 28 | ; a specific port; 29 | ; 'port' - to listen on a TCP socket to all addresses on a 30 | ; specific port; 31 | ; '/path/to/unix/socket' - to listen on a unix socket. 32 | ; Note: This value is mandatory. 33 | listen = /var/run/php8.0-fpm.sock 34 | 35 | ; Set listen(2) backlog. A value of '-1' means unlimited. 36 | ; Default Value: 128 (-1 on FreeBSD and OpenBSD) 37 | ;listen.backlog = -1 38 | 39 | ; Set permissions for unix socket, if one is used. In Linux, read/write 40 | ; permissions must be set in order to allow connections from a web server. Many 41 | ; BSD-derived systems allow connections regardless of permissions. 42 | ; Default Values: user and group are set as the running user 43 | ; mode is set to 0666 44 | listen.owner = www-data 45 | listen.group = www-data 46 | listen.mode = 0666 47 | 48 | ; List of ipv4 addresses of FastCGI clients which are allowed to connect. 49 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 50 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 51 | ; must be separated by a comma. If this value is left blank, connections will be 52 | ; accepted from any ip address. 53 | ; Default Value: any 54 | ;listen.allowed_clients = 127.0.0.1 55 | 56 | ; Choose how the process manager will control the number of child processes. 57 | ; Possible Values: 58 | ; static - a fixed number (pm.max_children) of child processes; 59 | ; dynamic - the number of child processes are set dynamically based on the 60 | ; following directives. With this process management, there will be 61 | ; always at least 1 children. 62 | ; pm.max_children - the maximum number of children that can 63 | ; be alive at the same time. 64 | ; pm.start_servers - the number of children created on startup. 65 | ; pm.min_spare_servers - the minimum number of children in 'idle' 66 | ; state (waiting to process). If the number 67 | ; of 'idle' processes is less than this 68 | ; number then some children will be created. 69 | ; pm.max_spare_servers - the maximum number of children in 'idle' 70 | ; state (waiting to process). If the number 71 | ; of 'idle' processes is greater than this 72 | ; number then some children will be killed. 73 | ; ondemand - no children are created at startup. Children will be forked when 74 | ; new requests will connect. The following parameter are used: 75 | ; pm.max_children - the maximum number of children that 76 | ; can be alive at the same time. 77 | ; pm.process_idle_timeout - The number of seconds after which 78 | ; an idle process will be killed. 79 | ; Note: This value is mandatory. 80 | pm = dynamic 81 | 82 | ; The number of child processes to be created when pm is set to 'static' and the 83 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 84 | ; This value sets the limit on the number of simultaneous requests that will be 85 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 86 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 87 | ; CGI. The below defaults are based on a server without much resources. Don't 88 | ; forget to tweak pm.* to fit your needs. 89 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 90 | ; Note: This value is mandatory. 91 | pm.max_children = 5 92 | 93 | ; The number of child processes created on startup. 94 | ; Note: Used only when pm is set to 'dynamic' 95 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 96 | pm.start_servers = 2 97 | 98 | ; The desired minimum number of idle server processes. 99 | ; Note: Used only when pm is set to 'dynamic' 100 | ; Note: Mandatory when pm is set to 'dynamic' 101 | pm.min_spare_servers = 1 102 | 103 | ; The desired maximum number of idle server processes. 104 | ; Note: Used only when pm is set to 'dynamic' 105 | ; Note: Mandatory when pm is set to 'dynamic' 106 | pm.max_spare_servers = 3 107 | 108 | ; The number of seconds after which an idle process will be killed. 109 | ; Note: Used only when pm is set to 'ondemand' 110 | ; Default Value: 10s 111 | ;pm.process_idle_timeout = 10s; 112 | 113 | ; The number of requests each child process should execute before respawning. 114 | ; This can be useful to work around memory leaks in 3rd party libraries. For 115 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 116 | ; Default Value: 0 117 | pm.max_requests = 100 118 | 119 | ; The URI to view the FPM status page. If this value is not set, no URI will be 120 | ; recognized as a status page. It shows the following informations: 121 | ; pool - the name of the pool; 122 | ; process manager - static, dynamic or ondemand; 123 | ; start time - the date and time FPM has started; 124 | ; start since - number of seconds since FPM has started; 125 | ; accepted conn - the number of request accepted by the pool; 126 | ; listen queue - the number of request in the queue of pending 127 | ; connections (see backlog in listen(2)); 128 | ; max listen queue - the maximum number of requests in the queue 129 | ; of pending connections since FPM has started; 130 | ; listen queue len - the size of the socket queue of pending connections; 131 | ; idle processes - the number of idle processes; 132 | ; active processes - the number of active processes; 133 | ; total processes - the number of idle + active processes; 134 | ; max active processes - the maximum number of active processes since FPM 135 | ; has started; 136 | ; max children reached - number of times, the process limit has been reached, 137 | ; when pm tries to start more children (works only for 138 | ; pm 'dynamic' and 'ondemand'); 139 | ; Value are updated in real time. 140 | ; Example output: 141 | ; pool: www 142 | ; process manager: static 143 | ; start time: 01/Jul/2011:17:53:49 +0200 144 | ; start since: 62636 145 | ; accepted conn: 190460 146 | ; listen queue: 0 147 | ; max listen queue: 1 148 | ; listen queue len: 42 149 | ; idle processes: 4 150 | ; active processes: 11 151 | ; total processes: 15 152 | ; max active processes: 12 153 | ; max children reached: 0 154 | ; 155 | ; By default the status page output is formatted as text/plain. Passing either 156 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 157 | ; output syntax. Example: 158 | ; http://www.foo.bar/status 159 | ; http://www.foo.bar/status?json 160 | ; http://www.foo.bar/status?html 161 | ; http://www.foo.bar/status?xml 162 | ; 163 | ; By default the status page only outputs short status. Passing 'full' in the 164 | ; query string will also return status for each pool process. 165 | ; Example: 166 | ; http://www.foo.bar/status?full 167 | ; http://www.foo.bar/status?json&full 168 | ; http://www.foo.bar/status?html&full 169 | ; http://www.foo.bar/status?xml&full 170 | ; The Full status returns for each process: 171 | ; pid - the PID of the process; 172 | ; state - the state of the process (Idle, Running, ...); 173 | ; start time - the date and time the process has started; 174 | ; start since - the number of seconds since the process has started; 175 | ; requests - the number of requests the process has served; 176 | ; request duration - the duration in µs of the requests; 177 | ; request method - the request method (GET, POST, ...); 178 | ; request URI - the request URI with the query string; 179 | ; content length - the content length of the request (only with POST); 180 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 181 | ; script - the main script called (or '-' if not set); 182 | ; last request cpu - the %cpu the last request consumed 183 | ; it's always 0 if the process is not in Idle state 184 | ; because CPU calculation is done when the request 185 | ; processing has terminated; 186 | ; last request memory - the max amount of memory the last request consumed 187 | ; it's always 0 if the process is not in Idle state 188 | ; because memory calculation is done when the request 189 | ; processing has terminated; 190 | ; If the process is in Idle state, then informations are related to the 191 | ; last request the process has served. Otherwise informations are related to 192 | ; the current request being served. 193 | ; Example output: 194 | ; ************************ 195 | ; pid: 31330 196 | ; state: Running 197 | ; start time: 01/Jul/2011:17:53:49 +0200 198 | ; start since: 63087 199 | ; requests: 12808 200 | ; request duration: 1250261 201 | ; request method: GET 202 | ; request URI: /test_mem.php?N=10000 203 | ; content length: 0 204 | ; user: - 205 | ; script: /home/fat/web/docs/php/test_mem.php 206 | ; last request cpu: 0.00 207 | ; last request memory: 0 208 | ; 209 | ; Note: There is a real-time FPM status monitoring sample web page available 210 | ; It's available in: ${prefix}/share/fpm/status.html 211 | ; 212 | ; Note: The value must start with a leading slash (/). The value can be 213 | ; anything, but it may not be a good idea to use the .php extension or it 214 | ; may conflict with a real PHP file. 215 | ; Default Value: not set 216 | pm.status_path = /php-status 217 | 218 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 219 | ; URI will be recognized as a ping page. This could be used to test from outside 220 | ; that FPM is alive and responding, or to 221 | ; - create a graph of FPM availability (rrd or such); 222 | ; - remove a server from a group if it is not responding (load balancing); 223 | ; - trigger alerts for the operating team (24/7). 224 | ; Note: The value must start with a leading slash (/). The value can be 225 | ; anything, but it may not be a good idea to use the .php extension or it 226 | ; may conflict with a real PHP file. 227 | ; Default Value: not set 228 | ;ping.path = /ping 229 | 230 | ; This directive may be used to customize the response of a ping request. The 231 | ; response is formatted as text/plain with a 200 response code. 232 | ; Default Value: pong 233 | ;ping.response = pong 234 | 235 | ; The access log file 236 | ; Default: not set 237 | ;access.log = log/$pool.access.log 238 | 239 | ; The access log format. 240 | ; The following syntax is allowed 241 | ; %%: the '%' character 242 | ; %C: %CPU used by the request 243 | ; it can accept the following format: 244 | ; - %{user}C for user CPU only 245 | ; - %{system}C for system CPU only 246 | ; - %{total}C for user + system CPU (default) 247 | ; %d: time taken to serve the request 248 | ; it can accept the following format: 249 | ; - %{seconds}d (default) 250 | ; - %{miliseconds}d 251 | ; - %{mili}d 252 | ; - %{microseconds}d 253 | ; - %{micro}d 254 | ; %e: an environment variable (same as $_ENV or $_SERVER) 255 | ; it must be associated with embraces to specify the name of the env 256 | ; variable. Some exemples: 257 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 258 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 259 | ; %f: script filename 260 | ; %l: content-length of the request (for POST request only) 261 | ; %m: request method 262 | ; %M: peak of memory allocated by PHP 263 | ; it can accept the following format: 264 | ; - %{bytes}M (default) 265 | ; - %{kilobytes}M 266 | ; - %{kilo}M 267 | ; - %{megabytes}M 268 | ; - %{mega}M 269 | ; %n: pool name 270 | ; %o: ouput header 271 | ; it must be associated with embraces to specify the name of the header: 272 | ; - %{Content-Type}o 273 | ; - %{X-Powered-By}o 274 | ; - %{Transfert-Encoding}o 275 | ; - .... 276 | ; %p: PID of the child that serviced the request 277 | ; %P: PID of the parent of the child that serviced the request 278 | ; %q: the query string 279 | ; %Q: the '?' character if query string exists 280 | ; %r: the request URI (without the query string, see %q and %Q) 281 | ; %R: remote IP address 282 | ; %s: status (response code) 283 | ; %t: server time the request was received 284 | ; it can accept a strftime(3) format: 285 | ; %d/%b/%Y:%H:%M:%S %z (default) 286 | ; %T: time the log has been written (the request has finished) 287 | ; it can accept a strftime(3) format: 288 | ; %d/%b/%Y:%H:%M:%S %z (default) 289 | ; %u: remote user 290 | ; 291 | ; Default: "%R - %u %t \"%m %r\" %s" 292 | ;access.format = %R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%% 293 | 294 | ; The log file for slow requests 295 | ; Default Value: not set 296 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 297 | ;slowlog = log/$pool.log.slow 298 | 299 | ; The timeout for serving a single request after which a PHP backtrace will be 300 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 301 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 302 | ; Default Value: 0 303 | ;request_slowlog_timeout = 0 304 | 305 | ; The timeout for serving a single request after which the worker process will 306 | ; be killed. This option should be used when the 'max_execution_time' ini option 307 | ; does not stop script execution for some reason. A value of '0' means 'off'. 308 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 309 | ; Default Value: 0 310 | ;request_terminate_timeout = 0 311 | 312 | ; Set open file descriptor rlimit. 313 | ; Default Value: system defined value 314 | ;rlimit_files = 1024 315 | 316 | ; Set max core size rlimit. 317 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 318 | ; Default Value: system defined value 319 | ;rlimit_core = 0 320 | 321 | ; Chroot to this directory at the start. This value must be defined as an 322 | ; absolute path. When this value is not set, chroot is not used. 323 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 324 | ; of its subdirectories. If the pool prefix is not set, the global prefix 325 | ; will be used instead. 326 | ; Note: chrooting is a great security feature and should be used whenever 327 | ; possible. However, all PHP paths will be relative to the chroot 328 | ; (error_log, sessions.save_path, ...). 329 | ; Default Value: not set 330 | ;chroot = 331 | 332 | ; Chdir to this directory at the start. 333 | ; Note: relative path can be used. 334 | ; Default Value: current directory or / when chroot 335 | chdir = / 336 | 337 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 338 | ; stderr will be redirected to /dev/null according to FastCGI specs. 339 | ; Note: on highloaded environement, this can cause some delay in the page 340 | ; process time (several ms). 341 | ; Default Value: no 342 | catch_workers_output = yes 343 | 344 | ; Limits the extensions of the main script FPM will allow to parse. This can 345 | ; prevent configuration mistakes on the web server side. You should only limit 346 | ; FPM to .php extensions to prevent malicious users to use other extensions to 347 | ; exectute php code. 348 | ; Note: set an empty value to allow all extensions. 349 | ; Default Value: .php 350 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 351 | 352 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 353 | ; the current environment. 354 | ; Default Value: clean env 355 | ;env[HOSTNAME] = $HOSTNAME 356 | env[PATH] = /srv/www/phpcs/scripts/:/usr/local/bin:/usr/bin:/bin 357 | ;env[TMP] = /tmp 358 | ;env[TMPDIR] = /tmp 359 | ;env[TEMP] = /tmp 360 | 361 | ; Additional php.ini defines, specific to this pool of workers. These settings 362 | ; overwrite the values previously defined in the php.ini. The directives are the 363 | ; same as the PHP SAPI: 364 | ; php_value/php_flag - you can set classic ini defines which can 365 | ; be overwritten from PHP call 'ini_set'. 366 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 367 | ; PHP call 'ini_set' 368 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 369 | 370 | ; Defining 'extension' will load the corresponding shared extension from 371 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 372 | ; overwrite previously defined php.ini values, but will append the new value 373 | ; instead. 374 | 375 | ; Note: path INI options can be relative and will be expanded with the prefix 376 | ; (pool, global or /usr) 377 | 378 | ; Default Value: nothing is defined by default except the values in php.ini and 379 | ; specified at startup with the -d argument 380 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 381 | ;php_flag[display_errors] = off 382 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 383 | ;php_admin_flag[log_errors] = on 384 | ;php_admin_value[memory_limit] = 32M 385 | -------------------------------------------------------------------------------- /php81/fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/8.1/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php8.1-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php8.1-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/8.1/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php81/php-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php8.1_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php81/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="8.1" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.1. As long as php8.1-fpm and php8.1-cli are 14 | # installed, there is no need to install the general php8.1 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp -f "${DIR}/upstream.conf" "/etc/nginx/upstreams/php81.conf" 72 | echo " * Copied ${DIR}/upstream.conf to /etc/nginx/upstreams/php81.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP ${PHPVERSION} provisioning complete" 115 | -------------------------------------------------------------------------------- /php81/upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php81 { 3 | server unix:/var/run/php8.1-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php81/www.conf: -------------------------------------------------------------------------------- 1 | ; Start a new pool named 'www'. 2 | ; the variable $pool can we used in any directive and will be replaced by the 3 | ; pool name ('www' here) 4 | [www] 5 | 6 | ; Per pool prefix 7 | ; It only applies on the following directives: 8 | ; - 'slowlog' 9 | ; - 'listen' (unixsocket) 10 | ; - 'chroot' 11 | ; - 'chdir' 12 | ; - 'php_values' 13 | ; - 'php_admin_values' 14 | ; When not set, the global prefix (or /usr) applies instead. 15 | ; Note: This directive can also be relative to the global prefix. 16 | ; Default Value: none 17 | ;prefix = /path/to/pools/$pool 18 | 19 | ; Unix user/group of processes 20 | ; Note: The user is mandatory. If the group is not set, the default user's group 21 | ; will be used. 22 | user = www-data 23 | group = www-data 24 | 25 | ; The address on which to accept FastCGI requests. 26 | ; Valid syntaxes are: 27 | ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on 28 | ; a specific port; 29 | ; 'port' - to listen on a TCP socket to all addresses on a 30 | ; specific port; 31 | ; '/path/to/unix/socket' - to listen on a unix socket. 32 | ; Note: This value is mandatory. 33 | listen = /var/run/php8.1-fpm.sock 34 | 35 | ; Set listen(2) backlog. A value of '-1' means unlimited. 36 | ; Default Value: 128 (-1 on FreeBSD and OpenBSD) 37 | ;listen.backlog = -1 38 | 39 | ; Set permissions for unix socket, if one is used. In Linux, read/write 40 | ; permissions must be set in order to allow connections from a web server. Many 41 | ; BSD-derived systems allow connections regardless of permissions. 42 | ; Default Values: user and group are set as the running user 43 | ; mode is set to 0666 44 | listen.owner = www-data 45 | listen.group = www-data 46 | listen.mode = 0666 47 | 48 | ; List of ipv4 addresses of FastCGI clients which are allowed to connect. 49 | ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original 50 | ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address 51 | ; must be separated by a comma. If this value is left blank, connections will be 52 | ; accepted from any ip address. 53 | ; Default Value: any 54 | ;listen.allowed_clients = 127.0.0.1 55 | 56 | ; Choose how the process manager will control the number of child processes. 57 | ; Possible Values: 58 | ; static - a fixed number (pm.max_children) of child processes; 59 | ; dynamic - the number of child processes are set dynamically based on the 60 | ; following directives. With this process management, there will be 61 | ; always at least 1 children. 62 | ; pm.max_children - the maximum number of children that can 63 | ; be alive at the same time. 64 | ; pm.start_servers - the number of children created on startup. 65 | ; pm.min_spare_servers - the minimum number of children in 'idle' 66 | ; state (waiting to process). If the number 67 | ; of 'idle' processes is less than this 68 | ; number then some children will be created. 69 | ; pm.max_spare_servers - the maximum number of children in 'idle' 70 | ; state (waiting to process). If the number 71 | ; of 'idle' processes is greater than this 72 | ; number then some children will be killed. 73 | ; ondemand - no children are created at startup. Children will be forked when 74 | ; new requests will connect. The following parameter are used: 75 | ; pm.max_children - the maximum number of children that 76 | ; can be alive at the same time. 77 | ; pm.process_idle_timeout - The number of seconds after which 78 | ; an idle process will be killed. 79 | ; Note: This value is mandatory. 80 | pm = dynamic 81 | 82 | ; The number of child processes to be created when pm is set to 'static' and the 83 | ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. 84 | ; This value sets the limit on the number of simultaneous requests that will be 85 | ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. 86 | ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP 87 | ; CGI. The below defaults are based on a server without much resources. Don't 88 | ; forget to tweak pm.* to fit your needs. 89 | ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' 90 | ; Note: This value is mandatory. 91 | pm.max_children = 5 92 | 93 | ; The number of child processes created on startup. 94 | ; Note: Used only when pm is set to 'dynamic' 95 | ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 96 | pm.start_servers = 2 97 | 98 | ; The desired minimum number of idle server processes. 99 | ; Note: Used only when pm is set to 'dynamic' 100 | ; Note: Mandatory when pm is set to 'dynamic' 101 | pm.min_spare_servers = 1 102 | 103 | ; The desired maximum number of idle server processes. 104 | ; Note: Used only when pm is set to 'dynamic' 105 | ; Note: Mandatory when pm is set to 'dynamic' 106 | pm.max_spare_servers = 3 107 | 108 | ; The number of seconds after which an idle process will be killed. 109 | ; Note: Used only when pm is set to 'ondemand' 110 | ; Default Value: 10s 111 | ;pm.process_idle_timeout = 10s; 112 | 113 | ; The number of requests each child process should execute before respawning. 114 | ; This can be useful to work around memory leaks in 3rd party libraries. For 115 | ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. 116 | ; Default Value: 0 117 | pm.max_requests = 100 118 | 119 | ; The URI to view the FPM status page. If this value is not set, no URI will be 120 | ; recognized as a status page. It shows the following informations: 121 | ; pool - the name of the pool; 122 | ; process manager - static, dynamic or ondemand; 123 | ; start time - the date and time FPM has started; 124 | ; start since - number of seconds since FPM has started; 125 | ; accepted conn - the number of request accepted by the pool; 126 | ; listen queue - the number of request in the queue of pending 127 | ; connections (see backlog in listen(2)); 128 | ; max listen queue - the maximum number of requests in the queue 129 | ; of pending connections since FPM has started; 130 | ; listen queue len - the size of the socket queue of pending connections; 131 | ; idle processes - the number of idle processes; 132 | ; active processes - the number of active processes; 133 | ; total processes - the number of idle + active processes; 134 | ; max active processes - the maximum number of active processes since FPM 135 | ; has started; 136 | ; max children reached - number of times, the process limit has been reached, 137 | ; when pm tries to start more children (works only for 138 | ; pm 'dynamic' and 'ondemand'); 139 | ; Value are updated in real time. 140 | ; Example output: 141 | ; pool: www 142 | ; process manager: static 143 | ; start time: 01/Jul/2011:17:53:49 +0200 144 | ; start since: 62636 145 | ; accepted conn: 190460 146 | ; listen queue: 0 147 | ; max listen queue: 1 148 | ; listen queue len: 42 149 | ; idle processes: 4 150 | ; active processes: 11 151 | ; total processes: 15 152 | ; max active processes: 12 153 | ; max children reached: 0 154 | ; 155 | ; By default the status page output is formatted as text/plain. Passing either 156 | ; 'html', 'xml' or 'json' in the query string will return the corresponding 157 | ; output syntax. Example: 158 | ; http://www.foo.bar/status 159 | ; http://www.foo.bar/status?json 160 | ; http://www.foo.bar/status?html 161 | ; http://www.foo.bar/status?xml 162 | ; 163 | ; By default the status page only outputs short status. Passing 'full' in the 164 | ; query string will also return status for each pool process. 165 | ; Example: 166 | ; http://www.foo.bar/status?full 167 | ; http://www.foo.bar/status?json&full 168 | ; http://www.foo.bar/status?html&full 169 | ; http://www.foo.bar/status?xml&full 170 | ; The Full status returns for each process: 171 | ; pid - the PID of the process; 172 | ; state - the state of the process (Idle, Running, ...); 173 | ; start time - the date and time the process has started; 174 | ; start since - the number of seconds since the process has started; 175 | ; requests - the number of requests the process has served; 176 | ; request duration - the duration in µs of the requests; 177 | ; request method - the request method (GET, POST, ...); 178 | ; request URI - the request URI with the query string; 179 | ; content length - the content length of the request (only with POST); 180 | ; user - the user (PHP_AUTH_USER) (or '-' if not set); 181 | ; script - the main script called (or '-' if not set); 182 | ; last request cpu - the %cpu the last request consumed 183 | ; it's always 0 if the process is not in Idle state 184 | ; because CPU calculation is done when the request 185 | ; processing has terminated; 186 | ; last request memory - the max amount of memory the last request consumed 187 | ; it's always 0 if the process is not in Idle state 188 | ; because memory calculation is done when the request 189 | ; processing has terminated; 190 | ; If the process is in Idle state, then informations are related to the 191 | ; last request the process has served. Otherwise informations are related to 192 | ; the current request being served. 193 | ; Example output: 194 | ; ************************ 195 | ; pid: 31330 196 | ; state: Running 197 | ; start time: 01/Jul/2011:17:53:49 +0200 198 | ; start since: 63087 199 | ; requests: 12808 200 | ; request duration: 1250261 201 | ; request method: GET 202 | ; request URI: /test_mem.php?N=10000 203 | ; content length: 0 204 | ; user: - 205 | ; script: /home/fat/web/docs/php/test_mem.php 206 | ; last request cpu: 0.00 207 | ; last request memory: 0 208 | ; 209 | ; Note: There is a real-time FPM status monitoring sample web page available 210 | ; It's available in: ${prefix}/share/fpm/status.html 211 | ; 212 | ; Note: The value must start with a leading slash (/). The value can be 213 | ; anything, but it may not be a good idea to use the .php extension or it 214 | ; may conflict with a real PHP file. 215 | ; Default Value: not set 216 | pm.status_path = /php-status 217 | 218 | ; The ping URI to call the monitoring page of FPM. If this value is not set, no 219 | ; URI will be recognized as a ping page. This could be used to test from outside 220 | ; that FPM is alive and responding, or to 221 | ; - create a graph of FPM availability (rrd or such); 222 | ; - remove a server from a group if it is not responding (load balancing); 223 | ; - trigger alerts for the operating team (24/7). 224 | ; Note: The value must start with a leading slash (/). The value can be 225 | ; anything, but it may not be a good idea to use the .php extension or it 226 | ; may conflict with a real PHP file. 227 | ; Default Value: not set 228 | ;ping.path = /ping 229 | 230 | ; This directive may be used to customize the response of a ping request. The 231 | ; response is formatted as text/plain with a 200 response code. 232 | ; Default Value: pong 233 | ;ping.response = pong 234 | 235 | ; The access log file 236 | ; Default: not set 237 | ;access.log = log/$pool.access.log 238 | 239 | ; The access log format. 240 | ; The following syntax is allowed 241 | ; %%: the '%' character 242 | ; %C: %CPU used by the request 243 | ; it can accept the following format: 244 | ; - %{user}C for user CPU only 245 | ; - %{system}C for system CPU only 246 | ; - %{total}C for user + system CPU (default) 247 | ; %d: time taken to serve the request 248 | ; it can accept the following format: 249 | ; - %{seconds}d (default) 250 | ; - %{miliseconds}d 251 | ; - %{mili}d 252 | ; - %{microseconds}d 253 | ; - %{micro}d 254 | ; %e: an environment variable (same as $_ENV or $_SERVER) 255 | ; it must be associated with embraces to specify the name of the env 256 | ; variable. Some exemples: 257 | ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e 258 | ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e 259 | ; %f: script filename 260 | ; %l: content-length of the request (for POST request only) 261 | ; %m: request method 262 | ; %M: peak of memory allocated by PHP 263 | ; it can accept the following format: 264 | ; - %{bytes}M (default) 265 | ; - %{kilobytes}M 266 | ; - %{kilo}M 267 | ; - %{megabytes}M 268 | ; - %{mega}M 269 | ; %n: pool name 270 | ; %o: ouput header 271 | ; it must be associated with embraces to specify the name of the header: 272 | ; - %{Content-Type}o 273 | ; - %{X-Powered-By}o 274 | ; - %{Transfert-Encoding}o 275 | ; - .... 276 | ; %p: PID of the child that serviced the request 277 | ; %P: PID of the parent of the child that serviced the request 278 | ; %q: the query string 279 | ; %Q: the '?' character if query string exists 280 | ; %r: the request URI (without the query string, see %q and %Q) 281 | ; %R: remote IP address 282 | ; %s: status (response code) 283 | ; %t: server time the request was received 284 | ; it can accept a strftime(3) format: 285 | ; %d/%b/%Y:%H:%M:%S %z (default) 286 | ; %T: time the log has been written (the request has finished) 287 | ; it can accept a strftime(3) format: 288 | ; %d/%b/%Y:%H:%M:%S %z (default) 289 | ; %u: remote user 290 | ; 291 | ; Default: "%R - %u %t \"%m %r\" %s" 292 | ;access.format = %R - %u %t "%m %r%Q%q" %s %f %{mili}d %{kilo}M %C%% 293 | 294 | ; The log file for slow requests 295 | ; Default Value: not set 296 | ; Note: slowlog is mandatory if request_slowlog_timeout is set 297 | ;slowlog = log/$pool.log.slow 298 | 299 | ; The timeout for serving a single request after which a PHP backtrace will be 300 | ; dumped to the 'slowlog' file. A value of '0s' means 'off'. 301 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 302 | ; Default Value: 0 303 | ;request_slowlog_timeout = 0 304 | 305 | ; The timeout for serving a single request after which the worker process will 306 | ; be killed. This option should be used when the 'max_execution_time' ini option 307 | ; does not stop script execution for some reason. A value of '0' means 'off'. 308 | ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) 309 | ; Default Value: 0 310 | ;request_terminate_timeout = 0 311 | 312 | ; Set open file descriptor rlimit. 313 | ; Default Value: system defined value 314 | ;rlimit_files = 1024 315 | 316 | ; Set max core size rlimit. 317 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 318 | ; Default Value: system defined value 319 | ;rlimit_core = 0 320 | 321 | ; Chroot to this directory at the start. This value must be defined as an 322 | ; absolute path. When this value is not set, chroot is not used. 323 | ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one 324 | ; of its subdirectories. If the pool prefix is not set, the global prefix 325 | ; will be used instead. 326 | ; Note: chrooting is a great security feature and should be used whenever 327 | ; possible. However, all PHP paths will be relative to the chroot 328 | ; (error_log, sessions.save_path, ...). 329 | ; Default Value: not set 330 | ;chroot = 331 | 332 | ; Chdir to this directory at the start. 333 | ; Note: relative path can be used. 334 | ; Default Value: current directory or / when chroot 335 | chdir = / 336 | 337 | ; Redirect worker stdout and stderr into main error log. If not set, stdout and 338 | ; stderr will be redirected to /dev/null according to FastCGI specs. 339 | ; Note: on highloaded environement, this can cause some delay in the page 340 | ; process time (several ms). 341 | ; Default Value: no 342 | catch_workers_output = yes 343 | 344 | ; Limits the extensions of the main script FPM will allow to parse. This can 345 | ; prevent configuration mistakes on the web server side. You should only limit 346 | ; FPM to .php extensions to prevent malicious users to use other extensions to 347 | ; exectute php code. 348 | ; Note: set an empty value to allow all extensions. 349 | ; Default Value: .php 350 | ;security.limit_extensions = .php .php3 .php4 .php5 .php7 351 | 352 | ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from 353 | ; the current environment. 354 | ; Default Value: clean env 355 | ;env[HOSTNAME] = $HOSTNAME 356 | env[PATH] = /srv/www/phpcs/scripts/:/usr/local/bin:/usr/bin:/bin 357 | ;env[TMP] = /tmp 358 | ;env[TMPDIR] = /tmp 359 | ;env[TEMP] = /tmp 360 | 361 | ; Additional php.ini defines, specific to this pool of workers. These settings 362 | ; overwrite the values previously defined in the php.ini. The directives are the 363 | ; same as the PHP SAPI: 364 | ; php_value/php_flag - you can set classic ini defines which can 365 | ; be overwritten from PHP call 'ini_set'. 366 | ; php_admin_value/php_admin_flag - these directives won't be overwritten by 367 | ; PHP call 'ini_set' 368 | ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. 369 | 370 | ; Defining 'extension' will load the corresponding shared extension from 371 | ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not 372 | ; overwrite previously defined php.ini values, but will append the new value 373 | ; instead. 374 | 375 | ; Note: path INI options can be relative and will be expanded with the prefix 376 | ; (pool, global or /usr) 377 | 378 | ; Default Value: nothing is defined by default except the values in php.ini and 379 | ; specified at startup with the -d argument 380 | ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com 381 | ;php_flag[display_errors] = off 382 | ;php_admin_value[error_log] = /var/log/fpm-php.www.log 383 | ;php_admin_flag[log_errors] = on 384 | ;php_admin_value[memory_limit] = 32M 385 | -------------------------------------------------------------------------------- /php82/fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/8.2/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php8.2-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php8.2-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/8.2/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php82/php-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php8.2_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php82/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="8.2" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.2. As long as php8.2-fpm and php8.2-cli are 14 | # installed, there is no need to install the general php8.2 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful (commented out modules are not yet available) 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp -f "${DIR}/upstream.conf" "/etc/nginx/upstreams/php82.conf" 72 | echo " * Copied ${DIR}/upstream.conf to /etc/nginx/upstreams/php82.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP ${PHPVERSION} provisioning complete" 115 | -------------------------------------------------------------------------------- /php82/upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php82 { 3 | server unix:/var/run/php8.2-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /php83/fpm.conf: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;; 2 | ; FPM Configuration ; 3 | ;;;;;;;;;;;;;;;;;;;;; 4 | 5 | ; All relative paths in this configuration file are relative to PHP's install 6 | ; prefix (/usr). This prefix can be dynamically changed by using the 7 | ; '-p' argument from the command line. 8 | 9 | ; Include one or more files. If glob(3) exists, it is used to include a bunch of 10 | ; files from a glob(3) pattern. This directive can be used everywhere in the 11 | ; file. 12 | ; Relative path can also be used. They will be prefixed by: 13 | ; - the global prefix if it's been set (-p argument) 14 | ; - /usr otherwise 15 | ;include=/etc/php/8.3/fpm/*.conf 16 | 17 | ;;;;;;;;;;;;;;;;;; 18 | ; Global Options ; 19 | ;;;;;;;;;;;;;;;;;; 20 | 21 | [global] 22 | ; Pid file 23 | ; Note: the default prefix is /var 24 | ; Default Value: none 25 | pid = /run/php/php8.3-fpm.pid 26 | 27 | ; Error log file 28 | ; If it's set to "syslog", log is sent to syslogd instead of being written 29 | ; in a local file. 30 | ; Note: the default prefix is /var 31 | ; Default Value: log/php-fpm.log 32 | error_log = /var/log/php/php8.3-fpm.log 33 | 34 | ; syslog_facility is used to specify what type of program is logging the 35 | ; message. This lets syslogd specify that messages from different facilities 36 | ; will be handled differently. 37 | ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON) 38 | ; Default Value: daemon 39 | ;syslog.facility = daemon 40 | 41 | ; syslog_ident is prepended to every message. If you have multiple FPM 42 | ; instances running on the same server, you can change the default value 43 | ; which must suit common needs. 44 | ; Default Value: php-fpm 45 | ;syslog.ident = php-fpm 46 | 47 | ; Log level 48 | ; Possible Values: alert, error, warning, notice, debug 49 | ; Default Value: notice 50 | ;log_level = notice 51 | 52 | ; If this number of child processes exit with SIGSEGV or SIGBUS within the time 53 | ; interval set by emergency_restart_interval then FPM will restart. A value 54 | ; of '0' means 'Off'. 55 | ; Default Value: 0 56 | ;emergency_restart_threshold = 0 57 | 58 | ; Interval of time used by emergency_restart_interval to determine when 59 | ; a graceful restart will be initiated. This can be useful to work around 60 | ; accidental corruptions in an accelerator's shared memory. 61 | ; Available Units: s(econds), m(inutes), h(ours), or d(ays) 62 | ; Default Unit: seconds 63 | ; Default Value: 0 64 | ;emergency_restart_interval = 0 65 | 66 | ; Time limit for child processes to wait for a reaction on signals from master. 67 | ; Available units: s(econds), m(inutes), h(ours), or d(ays) 68 | ; Default Unit: seconds 69 | ; Default Value: 0 70 | ;process_control_timeout = 0 71 | 72 | ; The maximum number of processes FPM will fork. This has been design to control 73 | ; the global number of processes when using dynamic PM within a lot of pools. 74 | ; Use it with caution. 75 | ; Note: A value of 0 indicates no limit 76 | ; Default Value: 0 77 | ; process.max = 128 78 | 79 | ; Specify the nice(2) priority to apply to the master process (only if set) 80 | ; The value can vary from -19 (highest priority) to 20 (lower priority) 81 | ; Note: - It will only work if the FPM master process is launched as root 82 | ; - The pool process will inherit the master process priority 83 | ; unless it specified otherwise 84 | ; Default Value: no set 85 | ; process.priority = -19 86 | 87 | ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging. 88 | ; Default Value: yes 89 | ;daemonize = yes 90 | 91 | ; Set open file descriptor rlimit for the master process. 92 | ; Default Value: system defined value 93 | ;rlimit_files = 1024 94 | 95 | ; Set max core size rlimit for the master process. 96 | ; Possible Values: 'unlimited' or an integer greater or equal to 0 97 | ; Default Value: system defined value 98 | ;rlimit_core = 0 99 | 100 | ; Specify the event mechanism FPM will use. The following is available: 101 | ; - select (any POSIX os) 102 | ; - poll (any POSIX os) 103 | ; - epoll (linux >= 2.5.44) 104 | ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0) 105 | ; - /dev/poll (Solaris >= 7) 106 | ; - port (Solaris >= 10) 107 | ; Default Value: not set (auto detection) 108 | ;events.mechanism = epoll 109 | 110 | ; When FPM is build with systemd integration, specify the interval, 111 | ; in second, between health report notification to systemd. 112 | ; Set to 0 to disable. 113 | ; Available Units: s(econds), m(inutes), h(ours) 114 | ; Default Unit: seconds 115 | ; Default value: 10 116 | ;systemd_interval = 10 117 | 118 | ;;;;;;;;;;;;;;;;;;;; 119 | ; Pool Definitions ; 120 | ;;;;;;;;;;;;;;;;;;;; 121 | 122 | ; Multiple pools of child processes may be started with different listening 123 | ; ports and different management options. The name of the pool will be 124 | ; used in logs and stats. There is no limitation on the number of pools which 125 | ; FPM can handle. Your system will tell you anyway :) 126 | 127 | ; To configure the pools it is recommended to have one .conf file per 128 | ; pool in the following directory: 129 | include=/etc/php/8.3/fpm/pool.d/*.conf 130 | -------------------------------------------------------------------------------- /php83/php-custom.ini: -------------------------------------------------------------------------------- 1 | ; Much of the default text has been stripped from this config file in order to 2 | ; improve readability. If you'd like to explore various configurations of PHP 3 | ; by using this file, see http://www.php.net/manual/en/ini.core.php 4 | [PHP] 5 | 6 | ; Recommended that short tags - - are not used. 7 | short_open_tag = Off 8 | 9 | ; Issue warning if you pass a value by reference at function call time. 10 | allow_call_time_pass_reference = Off 11 | 12 | ; Maximum execution time of each script, in seconds. (Hard coded at 0 for CLI) 13 | max_execution_time = 30 14 | 15 | ; Maximum amount of memory a script may consume. 16 | memory_limit = 128M 17 | 18 | ; Show all errors except for notices. 19 | error_reporting = E_ALL | E_STRICT 20 | 21 | ; Display errors to STDOUT 22 | display_errors = On 23 | 24 | ; Log errors in addition to displaying them. 25 | log_errors = On 26 | 27 | ; Set maximum length of log_errors. 28 | log_errors_max_len = 1024 29 | 30 | ; Log repeated messages. 31 | ignore_repeated_errors = Off 32 | ignore_repeated_source = Off 33 | 34 | ; Store the last error/warning message in $php_errormsg (boolean). 35 | track_errors = Off 36 | 37 | ; Display HTML links to docs related to the error? 38 | html_errors = 1 39 | 40 | ; Log errors to specified file. 41 | error_log = /var/log/php/php8.3_errors.log 42 | 43 | ; Maximum size of POST data that PHP will accept. 44 | post_max_size = 1024M 45 | 46 | ; Maximum allowed size for uploaded files. 47 | upload_max_filesize = 1024M 48 | 49 | ; Maximum number of files that can be uploaded via a single request 50 | max_file_uploads = 20 51 | 52 | ; Default timeout for socket based streams (seconds) 53 | default_socket_timeout = 60 54 | -------------------------------------------------------------------------------- /php83/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | export DEBIAN_FRONTEND=noninteractive 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | # PACKAGE INSTALLATION 6 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 7 | PHPVERSION="8.3" 8 | 9 | apt_package_install_list=( 10 | 11 | # PHP 12 | # 13 | # Our base packages for php8.3. As long as php8.3-fpm and php8.3-cli are 14 | # installed, there is no need to install the general php8.3 package, which 15 | # can sometimes install apache as a requirement. 16 | "php${PHPVERSION}-fpm" 17 | "php${PHPVERSION}-cli" 18 | 19 | # Common and dev packages for php 20 | "php${PHPVERSION}-common" 21 | "php${PHPVERSION}-dev" 22 | 23 | # Extra PHP modules that we find useful (commented out modules are not yet available) 24 | "php${PHPVERSION}-imagick" 25 | "php${PHPVERSION}-memcache" 26 | "php${PHPVERSION}-memcached" 27 | "php${PHPVERSION}-pcov" 28 | "php${PHPVERSION}-ssh2" 29 | "php${PHPVERSION}-xdebug" 30 | "php${PHPVERSION}-bcmath" 31 | "php${PHPVERSION}-curl" 32 | "php${PHPVERSION}-gd" 33 | "php${PHPVERSION}-intl" 34 | "php${PHPVERSION}-mbstring" 35 | "php${PHPVERSION}-mysql" 36 | "php${PHPVERSION}-imap" 37 | "php${PHPVERSION}-soap" 38 | "php${PHPVERSION}-xml" 39 | "php${PHPVERSION}-zip" 40 | ) 41 | 42 | ### FUNCTIONS 43 | 44 | package_install() { 45 | 46 | # Update all of the package references before installing anything 47 | echo " * Running apt-get update..." 48 | apt-get -y update 49 | 50 | # Install required packages 51 | echo " * Installing apt-get packages..." 52 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken ${apt_package_install_list[@]}; then 53 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 54 | apt-get clean 55 | return 1 56 | fi 57 | 58 | # Remove unnecessary packages 59 | echo " * Removing unnecessary packages..." 60 | apt-get autoremove -y 61 | 62 | # Clean up apt caches 63 | echo " * Cleaning apt caches..." 64 | apt-get clean 65 | 66 | return 0 67 | } 68 | 69 | configure() { 70 | # Copy nginx configuration from local 71 | cp -f "${DIR}/upstream.conf" "/etc/nginx/upstreams/php83.conf" 72 | echo " * Copied ${DIR}/upstream.conf to /etc/nginx/upstreams/php83.conf" 73 | 74 | # Copy php-fpm configuration from local 75 | cp -f "${DIR}/fpm.conf" "/etc/php/${PHPVERSION}/fpm/php-fpm.conf" 76 | echo " * Copied ${DIR}/fpm.conf to /etc/php/${PHPVERSION}/fpm/php-fpm.conf" 77 | 78 | cp -f "${DIR}/www.conf" "/etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 79 | echo " * Copied ${DIR}/www.conf to /etc/php/${PHPVERSION}/fpm/pool.d/www.conf" 80 | 81 | cp -f "${DIR}/php-custom.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 82 | echo " * Copied ${DIR}/php-custom.ini to /etc/php/${PHPVERSION}/fpm/conf.d/php-custom.ini" 83 | 84 | cp -f "/srv/config/php-config/opcache.ini" "/etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 85 | echo " * Copied /srv/config/php-config/opcache.ini to /etc/php/${PHPVERSION}/fpm/conf.d/opcache.ini" 86 | 87 | cp -f "/srv/config/php-config/xdebug.ini" "/etc/php/${PHPVERSION}/mods-available/xdebug.ini" 88 | echo " * Copied /srv/config/php-config/xdebug.ini to /etc/php/${PHPVERSION}/mods-available/xdebug.ini" 89 | 90 | if [[ -e /srv/config/php-config/mailcatcher.ini ]]; then 91 | cp -f "/srv/config/php-config/mailcatcher.ini" "/etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 92 | echo " * Copied /srv/config/php-config/mailcatcher.ini to /etc/php/${PHPVERSION}/mods-available/mailcatcher.ini" 93 | 94 | fi 95 | if [[ -e /srv/config/php-config/mailhog.ini ]]; then 96 | cp -f "/srv/config/php-config/mailhog.ini" "/etc/php/${PHPVERSION}/mods-available/mailhog.ini" 97 | echo " * Copied /srv/config/php-config/mailhog.ini to /etc/php/${PHPVERSION}/mods-available/mailhog.ini" 98 | fi 99 | 100 | echo " * Restarting php${PHPVERSION}-fpm service " 101 | service "php${PHPVERSION}-fpm" restart 102 | } 103 | 104 | package_install 105 | configure 106 | 107 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 108 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 109 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 110 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 111 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 112 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 113 | 114 | echo " * PHP ${PHPVERSION} provisioning complete" 115 | -------------------------------------------------------------------------------- /php83/upstream.conf: -------------------------------------------------------------------------------- 1 | # Upstream to abstract backend connection(s) for PHP. 2 | upstream php83 { 3 | server unix:/var/run/php8.3-fpm.sock; 4 | } 5 | -------------------------------------------------------------------------------- /phpmyadmin/README.md: -------------------------------------------------------------------------------- 1 | # phpMyAdmin 2 | 3 | A web interface for MySQL and MariaDB. 4 | 5 | [https://www.phpmyadmin.net/](https://www.phpmyadmin.net/) 6 | 7 | ## Summary 8 | 9 | phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL over the Web. phpMyAdmin supports a wide range of operations on MySQL and MariaDB. Frequently used operations (managing databases, tables, columns, relations, indexes, users, permissions, etc) can be performed via the user interface, while you still have the ability to directly execute any SQL statement. 10 | -------------------------------------------------------------------------------- /phpmyadmin/config.inc.php: -------------------------------------------------------------------------------- 1 | . 9 | * 10 | * @package PhpMyAdmin 11 | */ 12 | 13 | /* 14 | * This is needed for cookie based authentication to encrypt password in 15 | * cookie 16 | */ 17 | $cfg['blowfish_secret'] = 'a8b7c6da8b7c6da8b7c6da8b7c6d7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */ 18 | 19 | /* 20 | * Servers configuration 21 | */ 22 | $i = 0; 23 | 24 | /* 25 | * First server 26 | */ 27 | $i++; 28 | /* Authentication type */ 29 | $cfg[ 'Servers' ][ $i ]['auth_type'] = 'cookie'; 30 | 31 | /* Server parameters */ 32 | $cfg[ 'Servers' ][ $i ]['host'] = 'localhost'; 33 | $cfg[ 'Servers' ][ $i ]['connect_type'] = 'tcp'; 34 | $cfg[ 'Servers' ][ $i ]['compress'] = false; 35 | 36 | /* Select mysql if your server does not have mysqli */ 37 | $cfg[ 'Servers' ][ $i ]['extension'] = 'mysqli'; 38 | $cfg[ 'Servers' ][ $i ]['AllowNoPassword'] = false; 39 | 40 | /* 41 | * phpMyAdmin configuration storage settings. 42 | */ 43 | 44 | /* User used to manipulate with storage */ 45 | // $cfg['Servers'][$i]['controlhost'] = ''; 46 | // $cfg['Servers'][$i]['controluser'] = 'pma'; 47 | // $cfg['Servers'][$i]['controlpass'] = 'pmapass'; 48 | 49 | /* Storage database and tables */ 50 | // $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin'; 51 | // $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; 52 | // $cfg['Servers'][$i]['relation'] = 'pma__relation'; 53 | // $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; 54 | // $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; 55 | // $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; 56 | // $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; 57 | // $cfg['Servers'][$i]['history'] = 'pma__history'; 58 | // $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; 59 | // $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; 60 | // $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords'; 61 | // $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; 62 | // $cfg['Servers'][$i]['recent'] = 'pma__recent'; 63 | /* Contrib / Swekey authentication */ 64 | // $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf'; 65 | 66 | /* 67 | * End of servers configuration 68 | */ 69 | 70 | /* 71 | * Directories for saving/loading files from server 72 | */ 73 | $cfg['UploadDir'] = ''; 74 | $cfg['SaveDir'] = ''; 75 | 76 | /** 77 | * Defines whether a user should be displayed a "show all (records)" 78 | * button in browse mode or not. 79 | * default = false 80 | */ 81 | //$cfg['ShowAll'] = true; 82 | 83 | /** 84 | * Number of rows displayed when browsing a result set. If the result 85 | * set contains more rows, "Previous" and "Next". 86 | * default = 30 87 | */ 88 | //$cfg['MaxRows'] = 50; 89 | 90 | /** 91 | * disallow editing of binary fields 92 | * valid values are: 93 | * false allow editing 94 | * 'blob' allow editing except for BLOB fields 95 | * 'noblob' disallow editing except for BLOB fields 96 | * 'all' disallow editing 97 | * default = blob 98 | */ 99 | //$cfg['ProtectBinary'] = 'false'; 100 | 101 | /** 102 | * Default language to use, if not browser-defined or user-defined 103 | * (you find all languages in the locale folder) 104 | * uncomment the desired line: 105 | * default = 'en' 106 | */ 107 | //$cfg['DefaultLang'] = 'en'; 108 | //$cfg['DefaultLang'] = 'de'; 109 | 110 | /** 111 | * default display direction (horizontal|vertical|horizontalflipped) 112 | */ 113 | //$cfg['DefaultDisplay'] = 'vertical'; 114 | 115 | 116 | /** 117 | * How many columns should be used for table display of a database? 118 | * (a value larger than 1 results in some information being hidden) 119 | * default = 1 120 | */ 121 | //$cfg['PropertiesNumColumns'] = 2; 122 | 123 | /** 124 | * Set to true if you want DB-based query history.If false, this utilizes 125 | * JS-routines to display query history (lost by window close) 126 | * 127 | * This requires configuration storage enabled, see above. 128 | * default = false 129 | */ 130 | //$cfg['QueryHistoryDB'] = true; 131 | 132 | /** 133 | * When using DB-based query history, how many entries should be kept? 134 | * 135 | * default = 25 136 | */ 137 | //$cfg['QueryHistoryMax'] = 100; 138 | 139 | /* 140 | * You can find more configuration options in the documentation 141 | * in the doc/ folder or at . 142 | */ 143 | 144 | $cfg['AllowUserDropDatabase'] = true; 145 | 146 | 147 | /* 148 | * Ignore file permissions on the config file. 149 | */ 150 | $cfg['CheckConfigurationPermissions'] = false; 151 | 152 | /* 153 | * Include a custom configuration file for phpMyAdmin if it exists locally. 154 | */ 155 | if ( file_exists( 'config.inc.custom.php' ) ) { 156 | include 'config.inc.custom.php'; 157 | } 158 | -------------------------------------------------------------------------------- /phpmyadmin/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | PHPMYADMINVERSION="5.2.1" 6 | echo " * Checking for phpMyAdmin v${PHPMYADMINVERSION}" 7 | 8 | # Download phpMyAdmin 9 | if [[ ! -f "/srv/www/default/database-admin/RELEASE-DATE-${PHPMYADMINVERSION}" ]]; then 10 | echo " * Removing older phpMyAdmin install from /srv/www/default/database-admin" 11 | rm -rf /srv/www/default/database-admin/* 12 | echo " * Downloading phpMyAdmin v${PHPMYADMINVERSION}" 13 | cd /tmp || return 1 14 | wget -q -O phpmyadmin.zip "https://files.phpmyadmin.net/phpMyAdmin/${PHPMYADMINVERSION}/phpMyAdmin-${PHPMYADMINVERSION}-all-languages.zip" 15 | echo " * Extracting phpMyAdmin v${PHPMYADMINVERSION} into /tmp" 16 | unzip phpmyadmin.zip 17 | rm -f /tmp/phpmyadmin.zip 18 | mkdir -p /srv/www/default/database-admin 19 | echo " * Clearing out old phpMyAdmin" 20 | rm -rf /srv/www/default/database-admin/* 21 | echo " * Copying phpMyAdmin v${PHPMYADMINVERSION} into place" 22 | cp -rf /tmp/phpMyAdmin-${PHPMYADMINVERSION}-all-languages/* /srv/www/default/database-admin/ 23 | echo " * Cleaning up install files" 24 | rm -rf /tmp/phpMyAdmin* 25 | echo " * phpMyAdmin v${PHPMYADMINVERSION} installation complete" 26 | else 27 | echo " * PHPMyAdmin v${PHPMYADMINVERSION} already installed." 28 | fi 29 | echo " * Overwriting config file with the latest version" 30 | cp -f "${DIR}/config.inc.php" "/srv/www/default/database-admin/" 31 | -------------------------------------------------------------------------------- /svn-folder-upgrade/README.md: -------------------------------------------------------------------------------- 1 | ## SVN Folder Upgrade 2 | 3 | If you have a very old SVN checkout, you might need to upgrade it before SVN can be used via `svn upgrade`. This utility searches your VVV `/srv/www` folder for svn checkouts that need upgrading, and will search 5 folders down. 4 | 5 | If you don't use `svn` this isn't very useful. This code used to be in VVV itself but was moved here in v3.5. 6 | 7 | To use this, add it to the core utility in `config/config.yml`, then reprovision: 8 | 9 | ```yaml 10 | utilities: 11 | core: # The core VVV utility 12 | - svn-folder-upgrade 13 | ... etc 14 | ``` 15 | -------------------------------------------------------------------------------- /svn-folder-upgrade/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | wpsvn_check() { 4 | # Get all SVN repos. 5 | svn_repos=$(find /srv/www -maxdepth 5 -type d -name '.svn'); 6 | 7 | # Do we have any? 8 | if [[ -n $svn_repos ]]; then 9 | echo " * ${#svn_repos[@]} SVN repositories found, checking for upgrades..." 10 | for repo in $svn_repos; do 11 | # Test to see if an svn upgrade is needed on this repo. 12 | svn_test=$( svn status -u "$repo" 2>&1 ); 13 | 14 | if [[ "$svn_test" == *"svn upgrade"* ]]; then 15 | # If it is needed do it! 16 | echo " * Upgrading SVN repository at: ${repo}" 17 | svn upgrade "${repo/%\.svn/}" 18 | echo " * SVN upgrade command finished in ${repo}" 19 | fi; 20 | done 21 | fi; 22 | } 23 | 24 | echo " * Searching for SVN repositories that need upgrading." 25 | wpsvn_check 26 | echo " * SVN repository upgrade search has ended." 27 | -------------------------------------------------------------------------------- /tideways/by-site.php: -------------------------------------------------------------------------------- 1 | #!/bin/env php 2 | $settings) { 13 | if(isset($settings['tideways'])) { 14 | $hosts_list = array_merge($hosts_list, $settings['hosts']); 15 | } 16 | } 17 | 18 | $json_data = json_encode($hosts_list); 19 | file_put_contents('/srv/config/tideways.json', $json_data); 20 | } 21 | -------------------------------------------------------------------------------- /tideways/config.php: -------------------------------------------------------------------------------- 1 | false, 5 | 'save.handler' => 'pdo', 6 | 'pdo' => array( 7 | 'dsn' => 'sqlite:/tmp/xhgui.sqlite3', 8 | 'user' => null, 9 | 'pass' => null, 10 | 'table' => 'results', 11 | 'tableWatch' => 'watches' 12 | ), 13 | 'templates.path' => dirname(__DIR__) . '/src/templates', 14 | 'date.format' => 'M jS H:i:s', 15 | 'detail.count' => 6, 16 | 'page.limit' => 25, 17 | 'run.view.filter.names' => array( 18 | 'wp_*', 19 | 'Composer*', 20 | ), 21 | ); 22 | 23 | $custom_args = array(); 24 | if( file_exists( './custom-config.php' ) ) { 25 | include_once './custom-config.php'; 26 | } 27 | 28 | // In config/config.php 29 | return array_merge( $defaults, $custom_args ); 30 | -------------------------------------------------------------------------------- /tideways/config.php-profiler.php: -------------------------------------------------------------------------------- 1 | \Xhgui\Profiler\Profiler::SAVER_STACK, 21 | 'save.handler.stack' => array( 22 | 'savers' => array( 23 | \Xhgui\Profiler\Profiler::SAVER_UPLOAD, 24 | \Xhgui\Profiler\Profiler::SAVER_FILE, 25 | ), 26 | // if saveAll=false, break the chain on successful save 27 | 'saveAll' => false, 28 | ), 29 | // subhandler specific configs 30 | 'save.handler.file' => array( 31 | 'filename' => '/tmp/xhgui.data.jsonl', 32 | ), 33 | 'save.handler.upload' => array( 34 | 'uri' => 'http://xhgui.vvv.test/run/import', 35 | 'timeout' => 3, 36 | 'token' => 'token', 37 | ), 38 | // If defined, use specific profiler 39 | // otherwise use any profiler that's found 40 | 'profiler' => \Xhgui\Profiler\Profiler::PROFILER_TIDEWAYS_XHPROF, 41 | // This allows to configure, what profiling data to capture 42 | 'profiler.flags' => array( 43 | \Xhgui\Profiler\ProfilingFlags::CPU, 44 | \Xhgui\Profiler\ProfilingFlags::MEMORY, 45 | \Xhgui\Profiler\ProfilingFlags::NO_BUILTINS, 46 | \Xhgui\Profiler\ProfilingFlags::NO_SPANS, 47 | ), 48 | // Environment variables to exclude from profiling data 49 | 'profiler.exclude-env' => array( 50 | ), 51 | // Other config 52 | 'profiler.enable' => function() { 53 | $is_vvv_tideways = false; 54 | 55 | if ( empty( $_SERVER['REMOTE_ADDR'] ) and !isset( $_SERVER['HTTP_USER_AGENT'] ) and count( $_SERVER['argv']) > 0 ) { 56 | // CLI 57 | if ( isset( $_SERVER['ENABLE_TIDEWAYS_CLI'] ) && $_SERVER['ENABLE_TIDEWAYS_CLI'] === '1' ) { 58 | $is_vvv_tideways = true; 59 | } 60 | } else { 61 | // Web requests: 62 | if ( !isset( $_SERVER['HTTP_HOST'] ) ) { 63 | return false; 64 | } 65 | 66 | if ( strpos( $_SERVER['HTTP_HOST'], 'vvv.test' ) != false ) { 67 | return false; 68 | } 69 | 70 | if ( file_exists( '/srv/config/tideways.json' ) ) { 71 | $data = json_decode( file_get_contents( '/srv/config/tideways.json' ) ); 72 | if ( !empty( $data ) && in_array( $_SERVER['HTTP_HOST'], $data ) ) { 73 | $is_vvv_tideways = true; 74 | } 75 | } 76 | 77 | if ( isset( $_REQUEST['enable-tideways'] ) && ( $_REQUEST['enable-tideways'] == true ) ) { 78 | $is_vvv_tideways = true; 79 | } 80 | } 81 | 82 | if( ! $is_vvv_tideways ) { 83 | return false; 84 | } 85 | 86 | return true; 87 | }, 88 | 'profiler.replace_url' => function($uri) { 89 | $query = parse_url($uri, PHP_URL_QUERY); 90 | if ( ! empty( $query ) ) { 91 | $params = []; 92 | parse_str( $query, $params ); 93 | if ( ! array_key_exists( 'enable-tideways', $params ) ) { 94 | return $uri; 95 | } 96 | $uri = str_replace('?enable-tideways=' . $params['enable-tideways'], '', $uri); 97 | $uri = str_replace('%3Fenable-tideways=' . $params['enable-tideways'], '', $uri); 98 | } 99 | return $uri; 100 | }, 101 | 'profiler.simple_url' => function($url) { 102 | return $url; 103 | }, 104 | 'profiler.options' => array(), 105 | ); 106 | 107 | $custom_args = array(); 108 | if( file_exists( './custom-config.php' ) ) { 109 | include './custom-config.php'; 110 | } 111 | 112 | try { 113 | $profiler = new \Xhgui\Profiler\Profiler( array_merge( $config, $custom_args ) ); 114 | $profiler->start(); 115 | } catch (Exception $e){ 116 | print_r($e); 117 | die(); //phpcs:ignore 118 | } 119 | -------------------------------------------------------------------------------- /tideways/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | listen 443 ssl; 4 | root /srv/www/default/xhgui/webroot; 5 | index index.php; 6 | server_name tideways.vvv.test xhgui.vvv.test; 7 | 8 | gzip off; 9 | 10 | location / { 11 | try_files $uri $uri/ /index.php?$args; 12 | } 13 | 14 | location ~ \.php$ { 15 | client_max_body_size 1024M; 16 | try_files $uri =404; 17 | include /etc/nginx/fastcgi_params; 18 | fastcgi_pass php74; 19 | fastcgi_index index.php; 20 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tideways/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Tideways with XHGui 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | DEFAULTPHP=$(php -r "echo substr(phpversion(),0,3);") 5 | 6 | VVV_CONFIG=/srv/vvv/config.yml 7 | for item in "/srv/vvv/config.yml" "/vagrant/config.yml" "/vagrant/vvv-config.yml"; do 8 | if [[ -f $item ]]; then 9 | VVV_CONFIG=$item 10 | break 11 | fi 12 | done 13 | 14 | function fetch_tideways_repo() { 15 | if [[ ! -d /var/local/tideways-php/.git ]]; then 16 | echo " * Cloning Tideways extension" 17 | mkdir /var/local/tideways-php 18 | chmod -R 777 /var/local/tideways-php 19 | chown vagrant:vagrant /var/local/tideways-php 20 | noroot git clone "https://github.com/tideways/php-xhprof-extension" /var/local/tideways-php 21 | else 22 | echo " * Updating Tideways extension" 23 | ( cd /var/local/tideways-php/ && git pull -q && git checkout -q ) 24 | fi 25 | } 26 | 27 | function install_tideways_for_php_version() { 28 | version=$1 29 | if [[ ! $(command -v php-config$version) ]]; then 30 | return 31 | fi 32 | echo " * Installing Tideways for PHP ${version}" 33 | php_modules_path=$("php-config${version}" --extension-dir) 34 | echo " * Copying tideways files for PHP ${version}" 35 | cp -f "${DIR}/tideways.ini" "/etc/php/${version}/mods-available/tideways_xhprof.ini" 36 | cp -f "${DIR}/xhgui-php.ini" "/etc/php/${version}/mods-available/xhgui.ini" 37 | if [[ ! -f "${php_modules_path}/tideways_xhprof.so" ]] || [[ $(stat -c %Y "${php_modules_path}/tideways_xhprof.so") -lt $(stat -c %Y "/var/local/tideways-php/.git/info/") ]]; then 38 | echo " * Compiling Tideways for PHP ${version}" 39 | cp -rf /var/local/tideways-php "/var/local/tideways-php${version}" 40 | cd "/var/local/tideways-php${version}" || return 1 41 | 42 | # switch to PHP version we're building for 43 | update-alternatives --set php "/usr/bin/php${version}" 44 | update-alternatives --set php-config "/usr/bin/php-config${version}" 45 | update-alternatives --set phpize "/usr/bin/phpize${version}" 46 | "phpize${version}" 47 | 48 | # configure and build 49 | ./configure --enable-tideways-xhprof --with-php-config="php-config${version}" 50 | make 51 | make install 52 | 53 | # perform cleanup 54 | cd "${DIR}" || return 1 55 | rm -rf "/var/local/tideways-php${version}" 56 | fi 57 | phpenmod -v "$version" tideways_xhprof 58 | phpenmod -v "$version" xhgui 59 | } 60 | 61 | function check_tideways_php() { 62 | cp -f "${DIR}/tideways-header.php" "/srv/tideways-header.php" 63 | # Tideways is only for php =>7.0 64 | for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" 65 | do 66 | if [[ $(command -v php-fpm$version) ]]; then 67 | install_tideways_for_php_version "${version}" 68 | fi 69 | done 70 | } 71 | 72 | function restart_php() { 73 | echo " * Restarting PHP-FPM server" 74 | for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" 75 | do 76 | if [[ $(command -v php-fpm$version) ]]; then 77 | service "php${version}-fpm" restart 78 | fi 79 | done 80 | echo " * Restarting Nginx" 81 | service nginx restart 82 | } 83 | 84 | function install_php_sqlite() { 85 | declare -a packages=() 86 | for version in "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3"; do 87 | if [[ $(command -v php$version) ]]; then 88 | packages+=("php${version}-sqlite3") 89 | fi 90 | done 91 | apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken "${packages[@]}" 92 | } 93 | 94 | function install_xhgui_frontend() { 95 | echo " * Installing XHGui" 96 | if [[ ! -d "/srv/www/default/xhgui" ]]; then 97 | echo -e " * Git cloning xhgui from https://github.com/perftools/xhgui.git" 98 | noroot git clone "https://github.com/perftools/xhgui.git" /srv/www/default/xhgui 99 | fi 100 | 101 | cd /srv/www/default/xhgui || return 1 102 | noroot git fetch origin 103 | noroot git checkout "0.21.3" 104 | # Xhgui install.php will execute composer without noroot and this generate git issues 105 | git config --global --add safe.directory /srv/www/default/xhgui 106 | 107 | noroot php install.php 108 | noroot cp -f "${DIR}/config.php" "/srv/www/default/xhgui/config/config.php" 109 | 110 | cp -f "${DIR}/nginx.conf" "/etc/nginx/custom-utilities/xhgui.conf" 111 | 112 | if [[ ! -d "/srv/www/default/php-profiler" ]]; then 113 | echo -e " * Installing php-profiler for XHGui" 114 | noroot mkdir -p /srv/www/default/php-profiler 115 | cd /srv/www/default/php-profiler || return 1 116 | noroot composer require --no-update perftools/php-profiler 117 | noroot composer require --no-update perftools/xhgui-collector 118 | noroot composer install 119 | else 120 | echo " * Updating php-profile for XHGui" 121 | cd /srv/www/default/php-profiler || return 1 122 | noroot composer update 123 | fi 124 | noroot cp -f "${DIR}/config.php-profiler.php" "/srv/www/default/php-profiler/config.php" 125 | } 126 | 127 | function enable_tideways_by_site() { 128 | echo " * Tideways-by-site started" 129 | 130 | php "${DIR}/by-site.php" "${VVV_CONFIG}" 131 | 132 | echo " * Tideways-by-site finished" 133 | } 134 | 135 | echo " * Ensuring PHP 7.4 is installed ( needed for XHGui )" 136 | ( cd "${DIR}/../php74/" && . provision.sh ) 137 | 138 | echo " * Installing Tideways & XHGui" 139 | install_php_sqlite 140 | install_xhgui_frontend 141 | fetch_tideways_repo 142 | check_tideways_php 143 | enable_tideways_by_site 144 | 145 | echo " * Restoring the default PHP CLI version ( ${DEFAULTPHP} )" 146 | update-alternatives --set php "/usr/bin/php${DEFAULTPHP}" 147 | update-alternatives --set phar "/usr/bin/phar${DEFAULTPHP}" 148 | update-alternatives --set phar.phar "/usr/bin/phar.phar${DEFAULTPHP}" 149 | update-alternatives --set phpize "/usr/bin/phpize${DEFAULTPHP}" 150 | update-alternatives --set php-config "/usr/bin/php-config${DEFAULTPHP}" 151 | 152 | restart_php 153 | 154 | if [[ ! -f "/srv/www/default/xhgui/composer.lock" ]]; then 155 | echo " * XHGui installation failed!" 156 | else 157 | echo " * Tideways and XHGui installed" 158 | fi 159 | -------------------------------------------------------------------------------- /tideways/tideways-header.php: -------------------------------------------------------------------------------- 1 | /dev/null 2>&1 && pwd )" 3 | IFS=$(echo -en "\n\b") 4 | 5 | VVV_CONFIG=/srv/vvv/config.yml 6 | for item in "/srv/vvv/config.yml" "/vagrant/config.yml" "/vagrant/vvv-config.yml"; do 7 | if [[ -f $item ]]; then 8 | VVV_CONFIG=$item 9 | break 10 | fi 11 | done 12 | 13 | codename=$(lsb_release --codename | cut -f2) 14 | CERTIFICATES_DIR="/srv/certificates" 15 | if [[ $codename == "trusty" ]]; then # VVV 2 uses Ubuntu 14 LTS trusty 16 | echo " ! WARNING: Unsupported Ubuntu 14 detected! Switching certificate folder, please upgrade to VVV 3+" 17 | CERTIFICATES_DIR="/vagrant/certificates" 18 | fi 19 | 20 | DEFAULT_CERT_DIR="${CERTIFICATES_DIR}/default" 21 | CA_DIR="${CERTIFICATES_DIR}/ca" 22 | ROOT_CA_DAYS=397 # MacOS/Apple won't accept Root CA's that last longer than this 23 | SITE_CERTIFICATE_DAYS=200 24 | 25 | # Fix a bug that happens if you run the provisioner sometimes 26 | if [[ ! -e ~/.rnd ]]; then 27 | echo " * Generating Random Number for cert generation..." 28 | openssl rand -out ~/.rnd -hex 256 2>&1 29 | fi 30 | 31 | get_sites() { 32 | local value="" 33 | value=$(shyaml keys sites 2> /dev/null < "${VVV_CONFIG}" ) 34 | echo "${value:-$@}" 35 | } 36 | 37 | get_host() { 38 | local value="" 39 | value=$(shyaml get-value "sites.${1}.hosts.0" 2> /dev/null < "${VVV_CONFIG}" ) 40 | echo "${value:-$@}" 41 | } 42 | 43 | get_hosts() { 44 | local value="" 45 | value=$(shyaml get-values "sites.${1}.hosts" 2> /dev/null < "${VVV_CONFIG}" ) 46 | echo "${value:-$@}" 47 | } 48 | 49 | install_root_certificate() { 50 | mkdir -p /usr/local/share/ca-certificates 51 | echo " * Adding root certificate to the VM" 52 | cp -f "${CA_DIR}/ca.crt" /usr/local/share/ca-certificates/vvv-ca.crt 53 | echo " * Updating loaded VM certificates" 54 | update-ca-certificates --fresh 55 | } 56 | 57 | create_root_certificate() { 58 | if [ ! -d "${CA_DIR}" ]; then 59 | echo " * Setting up VVV Certificate Authority" 60 | mkdir -p "${CA_DIR}" 61 | fi 62 | 63 | if [[ ! -e "${DEFAULT_CERT_DIR}/dev.key" ]]; then 64 | echo " * Generating key root certificate" 65 | openssl genrsa \ 66 | -out "${CA_DIR}/ca.key" \ 67 | 2048 &>/dev/null 68 | fi 69 | 70 | openssl req \ 71 | -x509 -new \ 72 | -nodes \ 73 | -key "${CA_DIR}/ca.key" \ 74 | -sha256 \ 75 | -days $ROOT_CA_DAYS \ 76 | -config "${DIR}/openssl-ca.conf" \ 77 | -out "${CA_DIR}/ca.crt" 78 | } 79 | 80 | setup_default_certificate_key_csr() { 81 | echo " * Generating key and CSR for vvv.test" 82 | 83 | if [[ ! -e "${DEFAULT_CERT_DIR}/dev.key" ]]; then 84 | echo " * Generating key for: 'vvv.test'" 85 | openssl genrsa \ 86 | -out "${DEFAULT_CERT_DIR}/dev.key" \ 87 | 2048 &>/dev/null 88 | fi 89 | 90 | if [[ ! -e "${DEFAULT_CERT_DIR}/dev.csr" ]]; then 91 | echo " * Generating CSR for: 'vvv.test'" 92 | openssl req \ 93 | -new \ 94 | -key "${DEFAULT_CERT_DIR}/dev.key" \ 95 | -out "${DEFAULT_CERT_DIR}/dev.csr" \ 96 | -subj "/CN=vvv.test/C=GB/ST=Test Province/L=Test Locality/O=VVV/OU=VVV" &>/dev/null 97 | fi 98 | } 99 | 100 | create_default_certificate() { 101 | echo " * Setting up default Certificate for vvv.test and vvv.local" 102 | 103 | mkdir -p "${DEFAULT_CERT_DIR}" 104 | 105 | setup_default_certificate_key_csr 106 | 107 | echo " * Removing and renewing the default certificate" 108 | if [[ -e "${DEFAULT_CERT_DIR}/dev.crt" ]]; then 109 | rm "${DEFAULT_CERT_DIR}/dev.crt" 110 | fi 111 | 112 | openssl x509 \ 113 | -req \ 114 | -in "${DEFAULT_CERT_DIR}/dev.csr" \ 115 | -CA "${CA_DIR}/ca.crt" \ 116 | -CAkey "${CA_DIR}/ca.key" \ 117 | -CAcreateserial \ 118 | -out "${DEFAULT_CERT_DIR}/dev.crt" \ 119 | -days $SITE_CERTIFICATE_DAYS \ 120 | -sha256 \ 121 | -extfile "${DIR}/openssl-default-cert.conf" &>/dev/null 122 | } 123 | 124 | install_default_certificate() { 125 | echo " * Symlinking default server certificate and key" 126 | 127 | rm -rf /etc/nginx/server-2.1.0.crt 128 | rm -rf /etc/nginx/server-2.1.0.key 129 | 130 | echo " * Symlinking ${DEFAULT_CERT_DIR}/dev.crt to /etc/nginx/server-2.1.0.crt" 131 | ln -s "${DEFAULT_CERT_DIR}/dev.crt" /etc/nginx/server-2.1.0.crt 132 | 133 | echo " * Symlinking ${DEFAULT_CERT_DIR}/dev.key to /etc/nginx/server-2.1.0.key" 134 | ln -s "${DEFAULT_CERT_DIR}/dev.key" /etc/nginx/server-2.1.0.key 135 | } 136 | 137 | setup_site_key_csr() { 138 | SITE=${1} 139 | SITE_ESCAPED="${SITE//./\\.}" 140 | COMMON_NAME=$(get_host "${SITE_ESCAPED}") 141 | SITE_CERT_DIR="${CERTIFICATES_DIR}/${SITE}" 142 | 143 | mkdir -p "${SITE_CERT_DIR}" 144 | 145 | if [[ ! -e "${SITE_CERT_DIR}/dev.key" ]]; then 146 | echo " * Generating key for: '${SITE}'" 147 | openssl genrsa \ 148 | -out "${SITE_CERT_DIR}/dev.key" \ 149 | 2048 &>/dev/null 150 | fi 151 | if [[ ! -e "${SITE_CERT_DIR}/dev.csr" ]]; then 152 | echo " * Generating CSR for: '${SITE}'" 153 | openssl req \ 154 | -new \ 155 | -key "${SITE_CERT_DIR}/dev.key" \ 156 | -out "${SITE_CERT_DIR}/dev.csr" \ 157 | -subj "/CN=${COMMON_NAME//\\/}/C=GB/ST=Test Province/L=Test Locality/O=VVV/OU=VVV" &>/dev/null 158 | fi 159 | } 160 | 161 | regenerate_site_certificate() { 162 | SITE=${1} 163 | SITE_CERT_DIR="${CERTIFICATES_DIR}/${SITE}" 164 | SITE_ESCAPED="${SITE//./\\.}" 165 | COMMON_NAME=$(get_host "${SITE_ESCAPED}") 166 | 167 | setup_site_key_csr "${SITE}" 168 | 169 | echo " * Generating new certificate for: '${SITE}'" 170 | rm -f "${SITE_CERT_DIR}/dev.crt" 171 | 172 | # Copy over the site conf stub then append the domains 173 | cp -f "${DIR}/openssl-site-stub.conf" "${SITE_CERT_DIR}/openssl.conf" 174 | 175 | HOSTS=$(get_hosts "${SITE_ESCAPED}") 176 | I=0 177 | for DOMAIN in ${HOSTS}; do 178 | ((I++)) 179 | echo "DNS.${I} = ${DOMAIN//\\/}" >> "${SITE_CERT_DIR}/openssl.conf" 180 | ((I++)) 181 | echo "DNS.${I} = *.${DOMAIN//\\/}" >> "${SITE_CERT_DIR}/openssl.conf" 182 | done 183 | 184 | openssl x509 \ 185 | -req \ 186 | -in "${SITE_CERT_DIR}/dev.csr" \ 187 | -CA "${CA_DIR}/ca.crt" \ 188 | -CAkey "${CA_DIR}/ca.key" \ 189 | -CAcreateserial \ 190 | -out "${SITE_CERT_DIR}/dev.crt" \ 191 | -days 200 \ 192 | -sha256 \ 193 | -extfile "${SITE_CERT_DIR}/openssl.conf" &>/dev/null 194 | } 195 | 196 | process_site_certificates() { 197 | echo " * Generating site certificates" 198 | for SITE in $(get_sites); do 199 | regenerate_site_certificate "${SITE}" 200 | done 201 | echo " * Finished generating site certificates" 202 | } 203 | 204 | create_root_certificate 205 | install_root_certificate 206 | create_default_certificate 207 | install_default_certificate 208 | process_site_certificates 209 | 210 | echo " * Finished generating TLS certificates" 211 | -------------------------------------------------------------------------------- /trusted-hosts/README.md: -------------------------------------------------------------------------------- 1 | # SSH Trusted Hosts 2 | 3 | When you SSH to a new domain for the first time, it asks if you want to trust the fingerprint for that server. This is very useful, but in VVV there is no way to say yes/no during a provision. So this utility adds several common hosts automatically. 4 | 5 | This utility is built in to newer versions of VVV, so isn't needed for most users. 6 | -------------------------------------------------------------------------------- /trusted-hosts/hosts.txt: -------------------------------------------------------------------------------- 1 | github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl 2 | github.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg= 3 | github.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk= 4 | 5 | gitlab.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFSMqzJeV9rUzU4kWitGjeR4PWSa29SPqJ1fVkhtj3Hw9xjLVXVYrU9QlYWrOLXBpQ6KWjbjTDTdDkoohFzgbEY= 6 | gitlab.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsj2bNKTBSpIYDEGk9KxsGh3mySTRgMtXL583qmBpzeQ+jqCMRgBqB98u3z++J1sKlXHWfM9dyhSevkMwSbhoR8XIq/U0tCNyokEi/ueaBMCvbcTHhO7FcwzY92WK4Yt0aGROY5qX2UKSeOvuP4D6TPqKF1onrSzH9bx9XUf2lEdWT/ia1NEKjunUqu1xOB/StKDHMoX4/OKyIzuS0q/T1zOATthvasJFoPrAjkohTyaDUz2LN5JoH839hViyEG82yB+MjcFV5MU3N1l1QL3cVUCh93xSaua1N85qivl+siMkPGbO5xR/En4iEY6K2XPASUEMaieWVNTRCtJ4S8H+9 7 | gitlab.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAfuCHKVTjquxvt6CM6tdG4SLp1Btn/nOeHHE5UOzRdf 8 | 9 | bitbucket.org ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDQeJzhupRu0u0cdegZIa8e86EG2qOCsIsD1Xw0xSeiPDlCr7kq97NLmMbpKTX6Esc30NuoqEEHCuc7yWtwp8dI76EEEB1VqY9QJq6vk+aySyboD5QF61I/1WeTwu+deCbgKMGbUijeXhtfbxSxm6JwGrXrhBdofTsbKRUsrN1WoNgUa8uqN1Vx6WAJw1JHPhglEGGHea6QICwJOAr/6mrui/oB7pkaWKHj3z7d1IC4KWLtY47elvjbaTlkN04Kc/5LFEirorGYVbt15kAUlqGM65pk6ZBxtaO3+30LVlORZkxOh+LKL/BvbZ/iRNhItLqNyieoQj/uh/7Iv4uyH/cV/0b4WDSd3DptigWq84lJubb9t/DnZlrJazxyDCulTmKdOR7vs9gMTo+uoIrPSb8ScTtvw65+odKAlBj59dhnVp9zd7QUojOpXlL62Aw56U4oO+FALuevvMjiWeavKhJqlR7i5n9srYcrNV7ttmDw7kf/97P5zauIhxcjX+xHv4M= 10 | bitbucket.org ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPIQmuzMBuKdWeF4+a2sjSSpBK0iqitSQ+5BM9KhpexuGt20JpTVM7u5BDZngncgrqDMbWdxMWWOGtZ9UgbqgZE= 11 | bitbucket.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIazEu89wgQZ4bqs3d63QSMzYVa0MuJ2e2gKTKqu+UUO 12 | -------------------------------------------------------------------------------- /trusted-hosts/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 4 | 5 | cp -f "${DIR}/hosts.txt" /etc/ssh/ssh_known_hosts 6 | -------------------------------------------------------------------------------- /webgrind/README.md: -------------------------------------------------------------------------------- 1 | # Webgrind 2 | 3 | Xdebug Profiling Web Frontend in PHP 4 | 5 | [https://github.com/jokkedk/webgrind](https://github.com/jokkedk/webgrind) 6 | 7 | ## Summary 8 | 9 | Webgrind is a [Xdebug](http://www.xdebug.org) profiling web frontend in PHP. It implements a subset of the features of [kcachegrind](http://kcachegrind.sourceforge.net/html/Home.html) and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job. Here's a screenshot showing the output from profiling: 10 | 11 | [![](http://jokke.dk/media/2008-webgrind/webgrind_small.png)](http://jokke.dk/media/2008-webgrind/webgrind_large.png) 12 | 13 | ## Features 14 | 15 | * Super simple, cross platform installation - obviously :) 16 | * Track time spent in functions by self cost or inclusive cost. Inclusive cost is time inside function + calls to other functions. 17 | * See if time is spent in internal or user functions. 18 | * See where any function was called from and which functions it calls. 19 | * Generate a call graph using [gprof2dot.py](https://github.com/jrfonseca/gprof2dot) 20 | -------------------------------------------------------------------------------- /webgrind/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vvv/webgrind", 3 | "type": "project", 4 | "require": { 5 | "oomphinc/composer-installers-extender": "^1.1 || ^2.0", 6 | "jokkedk/webgrind": "*" 7 | }, 8 | "extra": { 9 | "installer-types": ["application"], 10 | "installer-paths": { 11 | "/srv/www/default/webgrind/": ["jokkedk/webgrind"] 12 | } 13 | }, 14 | "config": { 15 | "allow-plugins": { 16 | "composer/installers": true, 17 | "oomphinc/composer-installers-extender": true 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /webgrind/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Webgrind install (for viewing callgrind/cachegrind files produced by 3 | # xdebug profiler) 4 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 5 | 6 | noroot() { 7 | sudo -EH -u "vagrant" "$@"; 8 | } 9 | 10 | # make sure the folder exists and is writable 11 | noroot mkdir -p /srv/www/default/webgrind/ 12 | 13 | # cleanup .git folder from pre-composer days 14 | if [ -d "/srv/www/default/webgrind/.git" ]; then 15 | echo " * Cleaning up .git folder from pre-composer provisioning" 16 | rm -r /srv/www/default/webgrind/.git 17 | fi 18 | 19 | # phpMyAdmin 20 | echo " * Installing/Updating webgrind, see https://github.com/jokkedk/webgrind ..." 21 | cd "${DIR}" || return 1 22 | noroot composer update --no-autoloader 23 | 24 | echo " * Finished webgrind provisioner" 25 | -------------------------------------------------------------------------------- /wpcli-dev/README.md: -------------------------------------------------------------------------------- 1 | # WP CLI dev 2 | 3 | This utility swaps the stable WP CLI with the bleeding edge WP CLI for internal development. 4 | 5 | The new dev build will be available in `/srv/www/wp-cli-dev` for changes, and as `wp-dev` in CLI. 6 | -------------------------------------------------------------------------------- /wpcli-dev/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Provision WP-CLI develop and do an alias to the original wpcli 3 | export DEBIAN_FRONTEND=noninteractive 4 | 5 | cd "/srv/www/" 6 | 7 | noroot() { 8 | sudo -EH -u "vagrant" "$@"; 9 | } 10 | 11 | DB_NAME='wp_cli_test' 12 | 13 | echo " * Provisioning WP-CLI-Dev" 14 | 15 | # Make a database, if we don't already have one 16 | echo -e " * Creating database '${DB_NAME}' (if it's not already there)" 17 | mysql -u root --password=root -e "CREATE DATABASE IF NOT EXISTS ${DB_NAME}" 18 | mysql -u root --password=root -e "GRANT ALL PRIVILEGES ON ${DB_NAME}.* TO wp_cli_test@localhost IDENTIFIED BY 'password1';" 19 | echo -e " * DB operations done." 20 | 21 | echo " * Installing jq package" 22 | if ! apt-get -y --allow-downgrades --allow-remove-essential --allow-change-held-packages -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew install --fix-missing --fix-broken jq; then 23 | echo " * Installing apt-get packages returned a failure code, cleaning up apt caches then exiting" 24 | apt-get clean 25 | return 1 26 | fi 27 | 28 | if [[ ! -d /srv/www/wp-cli-dev/.git ]]; then 29 | echo " * Downloading official WP-CLI-Dev environment" 30 | noroot git clone https://github.com/wp-cli/wp-cli-dev 31 | else 32 | echo "* Updating official WP-CLI-Dev environment" 33 | ( cd /srv/www/wp-cli-dev/ && noroot git pull -q && noroot git checkout -q ) 34 | fi 35 | 36 | cd /srv/www/wp-cli-dev 37 | echo " * Running composer install" 38 | noroot composer install --no-dev 39 | 40 | echo " * Creating the symlink as wp-dev" 41 | ln -sf /srv/www/wp-cli-dev/vendor/bin/wp /usr/local/bin/wp-dev 42 | 43 | echo " * WP-CLI Dev provisioned" 44 | -------------------------------------------------------------------------------- /yarn/provision.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Yarn is a package manager that doubles down as project manager. 4 | # Whether you work on one-shot projects or large monorepos, as 5 | # a hobbyist or an enterprise user, we've got you covered. 6 | # 7 | # https://yarnpkg.com/ 8 | 9 | echo " * Checking for Yarn." 10 | noroot npm install -g yarn 11 | echo " ✓ Yarn installed." 12 | --------------------------------------------------------------------------------