Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
php:macos-installation [2021-02-28] – ↷ Page name changed from php:build-on-macos to php:macos-installation dcaiphp:macos-installation [2021-10-31] (current) dcai
Line 1: Line 1:
 +===== PHP 7.4 macOS installation =====
 +
 +
 +==== install packages ====
 <code> <code>
-fish shell +brew install php@7.4 nginx postgresql@12 
-brew install asdf bison autoconf re2c gawk pkg-config libgd libiconv libpq +pecl install zip libsodium 
-env PHP_WITHOUT_PEAR=yes asdf install php 7.4.14+# remove duplicated extension added in /usr/local/etc/php/7.4/php.ini 
 +brew link php@7.4 
 +brew link postgresql@12 
 +</code> 
 + 
 + 
 +==== setup postgres ==== 
 +<code> 
 +# init db 
 +initdb -D /Users/dcai/.local/var/postgres12 
 +# start db 
 +postgres -D ~/.local/var/postgres12/ 
 +echo "ALTER USER postgres WITH PASSWORD 'postgres';" | psql -U postgres 
 +</code> 
 + 
 +==== update php fpm config ==== 
 + 
 +''/opt/homebrew/etc/php/7.4/php-fpm.d/www.conf'' 
 +<code> 
 +[www] 
 +user = _www 
 +group = _www 
 +listen = 127.0.0.1:9991 
 +pm = ondemand 
 +pm.max_children = 5 
 + 
 +php_admin_flag[log_errors] = on 
 +php_admin_flag[display_errors] = on 
 + 
 +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/Sydney 
 +php_admin_value[error_log] = /tmp/phperror.log 
 +</code> 
 + 
 +==== update nginx config ==== 
 + 
 +''/opt/homebrew/etc/nginx/nginx.conf'' 
 + 
 +<code> 
 + 
 +worker_processes  1; 
 +error_log  /tmp/nginx-error.log; 
 +events { 
 +    worker_connections  1024; 
 +
 + 
 +http { 
 +    include       mime.types; 
 +    default_type  application/octet-stream; 
 +    sendfile        on; 
 +    keepalive_timeout  65; 
 +    server { 
 +        listen       8080; 
 +        server_name  localhost; 
 + 
 +        location / { 
 +            root   /Users/dcai/moodles/www; 
 +            index  index.php index.html index.htm; 
 +        } 
 + 
 +        location ~ [^/]\.php(/|$) { 
 +            root   /Users/dcai/moodles/www; 
 +            fastcgi_split_path_info  ^(.+\.php)(/.+)$; 
 +            fastcgi_index            index.php; 
 +            fastcgi_pass             127.0.0.1:9991; 
 +            include                  fastcgi_params; 
 +            fastcgi_param   PATH_INFO       $fastcgi_path_info; 
 +            fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name; 
 +        } 
 +    } 
 +    include servers/*; 
 +
 </code> </code>
php/macos-installation.1614507940.txt.gz · Last modified: by dcai