MAC Big Sur NGINX Installation PHP-FPM error

After PHP7 installation and try run

$ php-fpm

Below error:

ERROR:failed to open configuration file ‘/private/etc/php-fpm.conf’: No such file or directory..

It is due to the configuration file with the path /private/etc/php-fpm.conf and the file does not exist.
To solve this cp /private/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
After copying this file, you need to modify some of the things in this php-fpm.conf file

  1.  ; Note: the default prefix is /usr/var
  2. ; Default Value: log/php-fpm.log
  3. error_log = log/php-fpm.log

Note that there is an error_log, the default directory is /usr/var/…, but there is no such path in the mac directory, so if you run php-fpm at this time, you will get an error:

  1.  $ php-fpm –fpm-config /usr/local/etc/php-fpm.conf
  2.  ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory

We can modify this configuration code:

error_log = /usr/local/var/log/php-fpm.log

Similarly, modify the pid:

pid = /usr/local/var/run/php-fpm.pid

Note that the last line of this configuration file is:include=/private/etc/php-fpm.d/*.conf
will read all files in the /private/etc/php-fpm.d/ directory with the .conf suffix, and the .conf file does not exist, so we copy one directly. /private/etc/php-fpm.d/www.conf.defaultIs /private/etc/php-fpm.d/www.conf.Just fine.

Run:
$ php-fpm –fpm-config /usr/local/etc/php-fpm.conf
If an error occurs:
ERROR: unable to bind listening socket for address ’127.0.0.1:9000′: Address
This shows that 127.0.0.1:9000 has been bound and can be resolved by the command killall php-fpm

By Keenlio, December 28, 2020

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *


four − = 3

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>