Mac comes with php-fpm, execute php-fpm in the terminal, the following error will be reported:
ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2) ERROR: failed to load configuration file '/private/etc/php-fpm.conf' ERROR: FPM initialization failed123
The error message shows that the configuration file cannot be opened, cd /private/etc, and found that there is no php-fpm.conf file, but there is a php-fpm.conf.default file. This file is the default configuration, we can make a copy and rename it to php-fpm.conf.
cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf1
After cp finishes the file, execute php-fpm, and an error is reported again:
WARNING: Nothing matches the include pattern '/private/etc/php-fpm.d/*.conf' from /private/etc/php-fpm.conf at line 143. ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2) ERROR: failed to post process the configuration ERROR: FPM initialization failed1234
The first error message shows that /private/etc/php-fpm.d/*.conf cannot be found, cd /private/etc/php-fpm.d, there is indeed no file ending with .conf, but there is www. conf.default file, this is also the default configuration, we make a copy of the same as above, and change the name at will. We will use www.conf here.
cp /private/etc/php-fpm.d/www.conf.default /private/etc/php-fpm.d/www.conf1
Execute php-fpm and find that the first problem is gone, but other errors are still reported:
WARNING: Nothing matches the include pattern '/private/etc/php-fpm.d/*.conf' from /private/etc/php-fpm.conf at line 143. ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2) ERROR: failed to post process the configuration123
The error message shows that the error log file cannot be opened. cd /usr/var/log found that there is no such directory at all, not even the var directory, plus in order to avoid permission problems, simply configure it to the /usr/local/var/log directory.
cd /private/etc, modify the error_log configuration in php-fpm.conf to /usr/local/var/log/php-fpm.log, remove the; before error_log.
Execute php-fpm and report an error again:
NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (48) ERROR: FPM initialization failed1234
The first two here are about insufficient permissions, so sudo php-fpm, there is only one problem:
ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (48) ERROR: FPM initialization failed12
Enter the configuration folder, cd /private/etc/php-fpm.d, edit the www.conf file just copied, and modify the listen to 127.0.0.1:9999.
The last time sudo php-fpm, this time there is no problem
Execute sudo php-fpm -t
NOTICE: configuration file /private/etc/php-fpm.conf test is successful1
The test is successful, it is over here.
This article refers to: https://www.cnblogs.com/xielisen/p/10309836.html (most of them are plagiarism, don’t know if it is reprinted:) Some of the problems encountered in configuring your mac are not the same in detail, The process is roughly the same!