Mac OS X 10.9 already comes with php-fpm. for people with obsessive-compulsive disorder in a clean system or with an original controller, reinstalling it with brewhome always feels like a bunny in your mind, configure the original php-fpm.Run directly. If an error occurs, the configuration file cannot be found.
$ 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
The configuration file can be generated in the/private/etc/directory, and the root permission (sudo) is required)
You can also place the configuration file in a directory with the permission of a common user and specify the location of the configuration file through the -- fpm-config parameter, as shown below:
# 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 display: the "log" file cannot be correctly opened because it works in the/usr/var directory by default. you can modify the configuration file to specify the correct log file path.
$ Vim/usr/local/etc/php-fpm.conf
Modify the error_log entry in the php-fpm.conf file. the default prefix is/usr/var, but this path does not exist.
Error_log =/usr/local/var/log/php-fpm.log
Pid =/usr/local/var/run/php-fpm.pid
Or, do not modify the path of the configuration item in the configuration file. in the php-fpm running parameter (-p), specify the relative path prefix of the running file.
$ Php-fpm -- fpm-config/usr/local/etc/php-fpm.conf -- prefix/usr/local/var
By now, the php-fpm daemon can be started correctly.
Next, let's take a look at the php. ini configuration file and the extension installation.
First, let's take a look at the compilation parameters. some values are compiled into the execution program and cannot be changed.
$ Php-I | grep config
Find the location of the configuration file (php. ini) and directory, and specify the values of the following two items
'-- With-config-file-path =/etc'
'-- With-config-file-scan-dir =/Library/Server/Web/Config/php'
Therefore, we need to create php under the/etc directory. ini and Mac provide the sample file php in/private/etc and/etc. ini. default: check that the two files are identical, so it doesn't matter which one to copy. The Mac provides md5 instead of md5sum in Linux:
$ 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 permission: root: wheel. you need the root permission or use sudo. for details about how to set the password required for Mac sudo commands, refer
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
To change own, you do not need to change the root account in the future. it is best not to change the production environment.
# Chown <你的用户名> /Etc/php. ini
# Chmod u + w/etc/php. ini
Install PHP extension
The/Library/Server/Web/Config/php directory does not exist, or the Mac OS X Server version does not exist. if you do not know it, create it manually with the root permission.
# Mkdir-p/Library/Server/Web/Config/php
Compile extension, brewhome is another way, brew installation extension needs to rely on php, such as php54-redis will rely on php54, as to whether the compiled extension can be configured to the built-in, no experiment. The following uses the php_discuz extension (https://github.com/potterhe/php_discuzdownload) as an example.
If the extended source code is in the/Users/apple/php_discuz Directory
$./Configure
$ Make
After compilation extension, it is stored in/Users/apple/php_discuz/modules/discuz. so by default.
Open the extension in the configuration file
$ Echo "extension =/Users/apple/php_discuz/modules/discuz. so">/Library/Server/Web/Config/php/discuz. ini
Test and verification
$ Php-I | grep discuz
Discuz support => enabled
Run case test
$ Php-f/Users/apple/php_discuz/discuz. php