Mac Boot PHP-FPM error failed to open configuration file '/private/etc/php-fpm.conf ': No such file or Direc

Source: Internet
Author: User
Tags fpm root access

Run directly, there is an error can not find the configuration file.

$ php-fpm

[11-jan-2014 16:03:03] error:failed to open configuration file '/private/etc/php-fpm.conf ': No such file or directory (2)

[11-jan-2014 16:03:03] error:failed to load configuration file '/private/etc/php-fpm.conf '

[11-jan-2014 16:03:03] ERROR:FPM initialization failed

Configuration files can be generated under the/private/etc/directory, requiring root access (sudo)

Or in a directory where ordinary users have permissions to place the configuration file, the--fpm-config parameter specifies the location of the configuration file, as follows:

# cp/private/etc/php-fpm.conf.default/usr/local/etc/php-fpm.conf

$ php-fpm--fpm-config/usr/local/etc/php-fpm.conf

[11-jan-2014 16:10:49] error:failed to open Error_log (/usr/var/log/php-fpm.log): No such file or directory (2)

[11-jan-2014 16:10:49] Error:failed to post process the configuration

[11-jan-2014 16:10:49] ERROR:FPM initialization failed

Error message: The "Log" file cannot be opened correctly because the default is to work in the/usr/var directory, you can modify the configuration file to specify the correct log file path

$ vim/usr/local/etc/php-fpm.conf

Modify the entries in the php-fpm.conf file error_log , the default prefix is/usr/var, but there is no such path

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

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

Or do not modify the path to the configuration item in the configuration file, in the PHP-FPM run parameter (-p), specify the relative path prefix of the placement runtime file

$ php-fpm--fpm-config/usr/local/etc/php-fpm.conf--prefix/usr/local/var

To this, the PHP-FPM daemon has basically been able to start correctly.

Let's look at the php.ini configuration file and the extended installation.

First look at the compilation parameters, some values are compiled into the execution of the program, cannot be changed.

$ php-i|grep Config

Locate the configuration file (php.ini), the directory location, and the values for the following two entries specify

'--with-config-file-path=/etc '

'--with-config-file-scan-dir=/library/server/web/config/php '

So we need to create php.ini,mac in the/etc directory in/private/etc,/ Etc are provided in the sample file Php.ini.default, through the inspection, two files are identical, so it doesn't matter which one to copy, Mac has to provide MD5 instead of Linux md5sum:

$ md5/private/etc/php.ini.default/etc/php.ini.default

MD5 (/private/etc/php.ini.default) = 1c47241665ea5efdc55fd5809f675449

MD5 (/etc/php.ini.default) = 1c47241665ea5efdc55fd5809f675449

/etc directory permissions Root:wheel, require root permission or use sudo, for instructions on how to set the password required for the sudo command of your Mac, see

Http://support.apple.com/kb/HT4103?viewlocale=zh_CN&locale=zh_CN

Http://support.apple.com/kb/PH6515?viewlocale=zh_CN

# Cp/etc/php.ini.default/etc/php.ini

Change own, later change not always switch root, production environment best not change

# Chown < your username >/etc/php.ini

# chmod U+w/etc/php.ini

Installing PHP Extensions

/library/server/web/config/php This directory does not exist, or Mac OS X Server version has it, do not know, manually create him, with root permissions

# mkdir-p/library/server/web/config/php

Compilation extension, Brewhome is a set up, the brew way to install the extension needs to rely on PHP, such as Php54-redis will rely on PHP54, as to whether the compiled extensions can be configured to bring their own, no experiment. The following is an example of a php_discuz extension (https://github.com/potterhe/php_discuz download).

If the extension source in the/users/apple/php_discuz directory

$./configure

$ make

After the extension is compiled, the default is stored in the/users/apple/php_discuz/modules/discuz.so

To open an extension in a configuration file

$ echo "extension=/users/apple/php_discuz/modules/discuz.so" >/library/server/web/config/php/discuz.ini

Test validation

$ php-i|grep Discuz

Discuz support = Enabled

Run the use case test

$ php-f/users/apple/php_discuz/discuz.php

Mac Boot PHP-FPM error failed to open configuration file '/private/etc/php-fpm.conf ': No such file or Direc

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.