I have managed to successfully install PHP-FPM using homebrew.
I have even configured my nginx.conf to work. However, whenever I do in the terminal:
$: php-fpm
I get the error :
[24-Jul-2013 19:58:34] ERROR: failed to open configuration file '/private/etc/php-fpm.conf': No such file or directory (2)
[24-Jul-2013 19:58:34] ERROR: failed to load configuration file '/private/etc/php-fpm.conf'
[24-Jul-2013 19:58:34] ERROR: FPM initialization failed
However, my nginx is working fine.
Here is the nginx.conf according to running Yii.
server {
listen 80;
server_name campusplugin;
set $host_path "/var/www/campusplugin";
root $host_path;
set $yii_bootstrap "index.php";
charset utf-8;
#access_log logs/host.access.log main;
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}
#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
root /var/www/campusplugin;
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
I am also not able to stop
the php-fpm. I need to stop it as I have modified the php.ini a little bit. What is the method to do it??
service php-fpm restart
-bash: service: command not found
Where am I going wrong?
Even when I am typing : php-fpm -v
I am getting :
php-fpm -v
PHP 5.3.15 (fpm-fcgi) (built: Aug 24 2012 17:45:59)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
However, it is showing the old php-fpm, as I had installed 5.4.
I used this guide for my set up: https://web.archive.org/web/20161220083008/https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew
And this command to restart my php-fpm:
brew services restart php56
If you don't have brew services, try installing it like this:
brew tap homebrew/services
In more modern versions, simply doing
brew services start php
brew services stop php
brew services restart php
would either start, stop or restart the php-fpm service.
Apple says: "The SystemStarter utility is deprecated."
But I found another great solution:
Put this in ~/Library/LaunchDaemons/: https://github.com/tarnfeld/osx-stack/blob/master/LaunchDaemons/org.php-fpm.plist
Change paths in this plist file according to your paths (e.g. my php-fpm executable is in /usr/sbin instead of /usr/local/sbin)
Put the following in a new file in /usr/sbin/ or /usr/local/sbin/
.
/#!/bin/sh
echo "Stopping php-fpm..."
launchctl unload -w /Users/<home-folder>/Library/LaunchDaemons/org.php-fpm.plist
echo "Starting php-fpm..."
launchctl load -w /Users/<home-folder>/Library/LaunchDaemons/org.php-fpm.plist
echo "php-fpm restarted"
exit 0
make sure that directory is in your $PATH
Now you can call 'php-restart' to restart php-fpm
(Thanks to another post)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With