This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| php:macos-installation [2021-10-28] – dcai | php:macos-installation [2021-10-31] (current) – dcai | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ===== PHP 7.4 macOS installation ===== | ||
| + | |||
| + | |||
| + | ==== install packages ==== | ||
| < | < | ||
| - | # fish shell | + | brew install php@7.4 nginx postgresql@12 |
| - | brew install php@7.4 nginx | + | # pecl install zip libsodium |
| - | pecl install zip libsodium | + | |
| # remove duplicated extension added in / | # remove duplicated extension added in / | ||
| + | brew link php@7.4 | ||
| + | brew link postgresql@12 | ||
| </ | </ | ||
| - | == update nginx config == | ||
| - | '' | + | ==== setup postgres ==== |
| + | < | ||
| + | # init db | ||
| + | initdb -D /Users/dcai/.local/var/ | ||
| + | # start db | ||
| + | postgres -D ~/.local/ | ||
| + | echo "ALTER USER postgres WITH PASSWORD | ||
| + | </ | ||
| + | ==== update php fpm config ==== | ||
| + | |||
| + | ''/ | ||
| < | < | ||
| + | [www] | ||
| + | user = _www | ||
| + | group = _www | ||
| + | listen = 127.0.0.1: | ||
| + | pm = ondemand | ||
| + | pm.max_children = 5 | ||
| - | #user nobody; | + | php_admin_flag[log_errors] = on |
| - | worker_processes | + | php_admin_flag[display_errors] = on |
| - | error_log | + | php_admin_value[memory_limit] = 1G |
| + | php_admin_value[upload_max_filesize] = 100M | ||
| + | php_admin_value[post_max_size] = 100M | ||
| + | php_admin_value[max_input_vars] = 5000 | ||
| + | php_admin_value[max_file_uploads] = 20 | ||
| + | php_admin_value[date.timezone] = Australia/ | ||
| + | php_admin_value[error_log] = /tmp/phperror.log | ||
| + | </ | ||
| - | #pid logs/nginx.pid; | + | ==== update |
| + | ''/ | ||
| + | |||
| + | < | ||
| + | worker_processes | ||
| + | error_log | ||
| events { | events { | ||
| worker_connections | worker_connections | ||
| } | } | ||
| - | |||
| http { | http { | ||
| include | include | ||
| default_type | default_type | ||
| - | |||
| - | # | ||
| - | # ' | ||
| - | # '" | ||
| - | |||
| - | # | ||
| - | |||
| sendfile | sendfile | ||
| - | # | ||
| - | |||
| - | # | ||
| keepalive_timeout | keepalive_timeout | ||
| - | |||
| - | #gzip on; | ||
| - | |||
| server { | server { | ||
| listen | listen | ||
| server_name | server_name | ||
| - | |||
| - | # | ||
| location / { | location / { | ||
| root / | root / | ||
| index index.php index.html index.htm; | index index.php index.html index.htm; | ||
| - | } | ||
| - | |||
| - | # | ||
| - | |||
| - | # redirect server error pages to the static page /50x.html | ||
| - | # | ||
| - | error_page | ||
| - | location = /50x.html { | ||
| - | root html; | ||
| } | } | ||
| Line 72: | Line 79: | ||
| fastcgi_param | fastcgi_param | ||
| } | } | ||
| - | |||
| - | # deny access to .htaccess files, if Apache' | ||
| - | # concurs with nginx' | ||
| - | # | ||
| - | #location ~ /\.ht { | ||
| - | # deny all; | ||
| - | #} | ||
| } | } | ||
| - | |||
| - | |||
| - | # another virtual host using mix of IP-, name-, and port-based configuration | ||
| - | # | ||
| - | #server { | ||
| - | # listen | ||
| - | # listen | ||
| - | # server_name | ||
| - | |||
| - | # location / { | ||
| - | # root html; | ||
| - | # index index.html index.htm; | ||
| - | # } | ||
| - | #} | ||
| - | |||
| - | |||
| - | # HTTPS server | ||
| - | # | ||
| - | #server { | ||
| - | # listen | ||
| - | # server_name | ||
| - | |||
| - | # ssl_certificate | ||
| - | # ssl_certificate_key | ||
| - | |||
| - | # ssl_session_cache | ||
| - | # ssl_session_timeout | ||
| - | |||
| - | # ssl_ciphers | ||
| - | # ssl_prefer_server_ciphers | ||
| - | |||
| - | # location / { | ||
| - | # root html; | ||
| - | # index index.html index.htm; | ||
| - | # } | ||
| - | #} | ||
| include servers/*; | include servers/*; | ||
| } | } | ||
| + | |||
| </ | </ | ||