停止“php-fpm”(自制软件安装)Mac OSX 10.8.2

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17837374/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:32:59  来源:igfitidea点击:

Stopping "php-fpm" ( homebrew installation ) Mac OSX 10.8.2

homebrewphp

提问by Sankalp Singha

I have managed to successfully install PHP-FPM using homebrew.

我已经成功地使用自制软件安装了 PHP-FPM。

I have even configured my nginx.conf to work. However, whenever I do in the terminal:

我什至配置了我的 nginx.conf 来工作。但是,每当我在终端中执行以下操作时:

$: 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.

但是,我的 nginx 工作正常。

Here is the nginx.conf according to running Yii.

这是根据运行 Yii 的 nginx.conf。

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 stopthe php-fpm. I need to stop it as I have modified the php.ini a little bit. What is the method to do it??

我也无法stop使用 php-fpm。我需要停止它,因为我稍微修改了 php.ini。有什么方法可以做到??

service php-fpm restart
-bash: service: command not found

Where am I going wrong?

我哪里错了?

Even when I am typing : php-fpm -vI am getting :

即使我在打字:php-fpm -v我得到:

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.

但是,它显示的是旧的 php-fpm,因为我安装了 5.4。

Regards,

问候,

采纳答案by Sankalp Singha

I got it :

我知道了 :

The method to do it was as follows :

方法如下:

1. To checkout php-fpm, use :

1. 要检查 php-fpm,请使用:

php-fpm php54-fpm 

2. To stop the service, we have to use Apple's SystemStarter, like so :

2.要停止服务,我们必须使用Apple的SystemStarter,如下所示:

SystemStarter php54-fpm restart

回答by colefner

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

我使用本指南进行设置: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:

这个命令可以重新启动我的 php-fpm:

brew services restart php56

If you don't have brew services, try installing it like this:

如果您没有 brew 服务,请尝试像这样安装它:

brew tap homebrew/services

Hope this helps!

希望这可以帮助!

回答by maikel

Apple says: "The SystemStarter utility is deprecated."

Apple 说:“不推荐使用 SystemStarter 实用程序。”

But I found another great solution:

但我找到了另一个很好的解决方案:

  1. Put this in ~/Library/LaunchDaemons/: https://github.com/tarnfeld/osx-stack/blob/master/LaunchDaemons/org.php-fpm.plist

  2. 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)

  3. Put the following in a new file in /usr/sbin/ or /usr/local/sbin/

  1. 把它放在 ~/Library/LaunchDaemons/: https://github.com/tarnfeld/osx-stack/blob/master/LaunchDaemons/org.php-fpm.plist

  2. 根据您的路径更改此 plist 文件中的路径(例如,我的 php-fpm 可执行文件位于 /usr/sbin 而不是 /usr/local/sbin)

  3. 将以下内容放入 /usr/sbin/ 或 /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

确保该目录在您的 $PATH 中

Now you can call 'php-restart' to restart php-fpm

现在你可以调用 'php-restart' 来重启 php-fpm

(Thanks to another post)

(感谢另一个帖子

回答by GeekHades

If you use mac, You can checkout your php-fpm is running?

如果您使用 mac,您可以检查您的 php-fpm 是否正在运行?

you can use this command: php-fpm -t

你可以使用这个命令:php-fpm -t

Now, You can see the question! And how to resolve by this error info in the command line!

现在,您可以看到问题了!以及如何通过命令行中的此错误信息解决!