Skip to content

Commit

Permalink
Add php-fpm user, group and listen to PHP post installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed May 12, 2023
1 parent 27dd2e4 commit 28dbe88
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 1.0.7: 2023-05-12

* Fix duplicate symlink for nginx folder
* Add php-fpm user, group and listen to PHP post installation instructions

### 1.0.6: 2022-11-28

Expand Down
44 changes: 41 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ Read the full story by [@ronilaukkarinen](https://github.com/ronilaukkarinen): *

### Post installations

You may want to add your user and group correctly to `/usr/local/etc/php/7.4/php-fpm.d/www.conf` and set these to the bottom:
#### PHP config

You may want to add your user and group correctly to `/opt/homebrew/etc/php/7.4/php-fpm.d/www.conf` (or wherever your www.conf is, find with `sudo find / -name 'www.conf'`) and set these to the bottom:

````
catch_workers_output = yes
Expand All @@ -103,7 +105,37 @@ Please note, if the file is not found (as the location may also be something lik
sudo find / -name 'www.conf'
```

Default vhost for your site (`/etc/nginx/sites-enabled/sitename.test`) could be something like:
#### Make sure the PHP runs on correct permissions

Make sure you have your user and group defined, use these as base (only change `rolle` to your own Mac username):

````config
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = rolle
group = admin
````

Also make sure you have listen set up properly

````config
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
````

#### Default nginx config

Make sure you have default vhost for your site (`/etc/nginx/sites-enabled/sitename.test`) could be something like:

```` nginx
server {
Expand All @@ -116,6 +148,8 @@ server {
}
````

#### Default MySQL my.cnf

Default my.cnf would be something like this (already added by install.sh in `/usr/local/etc/my.cnf`:

````
Expand Down Expand Up @@ -273,7 +307,7 @@ Test with `sudo nginx -t` and if everything is OK, restart nginx.
6. Check `php --version`, it should display something like this:

``` shell
$ php --version
$ php --version
PHP 7.4.23 (cli) (built: Aug 27 2021 09:20:14) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Expand Down Expand Up @@ -520,3 +554,7 @@ Open `/opt/homebrew/etc/nginx/nginx.conf` and add to first line:
```ini
user your_username staff;
```

#### "Primary script unknown" error in nginx log or "File not found." in browser

This is caused by php-fpm not running properly. Please [make sure the PHP runs on correct permissions](#make-sure-the-php-runs-on-correct-permissions) section.

0 comments on commit 28dbe88

Please sign in to comment.