Skip to content

Instantly share code, notes, and snippets.

@mburica
mburica / php-pools.md
Created October 21, 2021 19:50 — forked from holmberd/php-pools.md
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@mburica
mburica / fix-wsl2-dns-resolution
Created October 18, 2021 01:05 — forked from coltenkrauter/fix-wsl2-dns-resolution.md
Fix DNS resolution in WSL2
More recent resolution:
1. cd ~/../../etc (go to etc folder in WSL).
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line).
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line).
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian).
5. cd ~/../../etc (go to etc folder in WSL).
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file).
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and
secondary.
@mburica
mburica / submodules.md
Created November 3, 2020 22:24
Git Submodule Stuff

Git Submodules

Add a submodule to a repository

  • git submodule add --name NAME -b BRANCH_NAME ssh://git@bitbucket.pearson.com/mdl/REPO /path/to/install
  • Using the moodle-local-autoenrol plugin qa branch as an example it would be
    • git submodule add --name autoenrol -b qa ssh://git@bitbucket.pearson.com/mdl/moodle-local-autoenrol /local/autoenrol
    • Note: the path is relative to where you are running the command from
  • After you add the submodule you can run git status and you will see the /path/to/install for the repository you added and the .gitmodules file
    • If you look in the .gitmodules file you will see a new entry for your submodule that looks like

[submodule "autoenrol"]

@mburica
mburica / replacelinks.php
Created January 16, 2018 07:59
Replace Links #PHP
@mburica
mburica / arraycompare.php
Created January 11, 2018 21:25
Array Comparison #PHP
function array_equal($a, $b) {
return (
is_array($a) && is_array($b)
&& count($a) == count($b)
&& array_diff($a, $b) === array_diff($b, $a)
);
}