Home > Article > Backend Development > What to do if mac php-fpm reports an error
Mac php-fpm error solution: 1. Configure the "php-fpm.conf" file; 2. Modify "php-fpm.conf error_log"; 3. Kill the "php-fpm" process ;4. Stop all processes of the original "php-fpm" and then restart them.
The operating environment of this article: macOS10.15 system, PHP7.1 version, MacBook Air 2019 computer
The problem of starting php-fpm under starting php_Mac Solve
What is php-fpm
PHP-FPM (FastCGI Process Manager: FastCGI Process Manager) is a PHPFastCGI manager, which is built-in to PHP Function modules do not need to be downloaded separately.
Start php-fpm
1. Error report
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 failed
The error message shows that the configuration file cannot be opened, cd /private/etc, and it is 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, and then change the configuration as needed.
cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
2. Error report
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 failed
The error message is displayed and 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. In order to avoid permission problems, we simply configured it to the /usr/local/var/log directory.
Modify the php-fpm.conf error_log configuration to /usr/local/var/log/php-fpm.log, and change user and group to be the same as the current user.
3. Error
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
4. So sudo php-fpm, an error is reported again:
ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (48) ERROR: FPM initialization failed
9000 port is occupied, check whether php-fpm is open, and the server is not The process of php-fpm that has not been killed
netstat -lntup | grep 9000
Stop all the processes of the original php-fpm and restart
killall php-fpm sudo php-fpm
[Recommended learning: PHP video tutorial]
The above is the detailed content of What to do if mac php-fpm reports an error. For more information, please follow other related articles on the PHP Chinese website!