【问题标题】:Stopping "php-fpm" ( homebrew installation ) Mac OSX 10.8.2停止“php-fpm”(自制安装)Mac OSX 10.8.2
【发布时间】:2013-07-24 14:44:50
【问题描述】:

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

我什至已经配置了我的 nginx.conf 来工作。但是,每当我在终端中这样做时:

$: php-fpm

我得到了错误:

[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

但是,我的 nginx 工作正常。

这里是运行 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;
        }
    }

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

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

我哪里错了?

即使我在输入: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

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

【问题讨论】:

    标签: homebrew php


    【解决方案1】:

    我使用本指南进行设置: https://web.archive.org/web/20161220083008/https://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew

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

    brew services restart php56
    

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

    brew tap homebrew/services
    

    在更现代的版本中,只是做

    brew services start php
    brew services stop php
    brew services restart php
    

    将启动、停止或重新启动 php-fpm 服务。

    【讨论】:

      【解决方案2】:

      苹果说:"The SystemStarter utility is deprecated."

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

      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
      

      确保该目录在您的 $PATH 中

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

      (感谢another post

      【讨论】:

      • /Users/&lt;home-folder&gt; 可以替换为 ~。所以/Users/&lt;home-folder&gt;/Library~/Library是一样的
      • 卸载失败:5:输入/输出错误
      【解决方案3】:

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

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

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

      【讨论】:

        【解决方案4】:

        我明白了:

        方法如下:

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

        php-fpm php54-fpm 
        

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

        SystemStarter php54-fpm restart
        

        【讨论】:

        • 你到底有什么不明白的?第一还是第二?
        • SystemStarter 不存在了
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-11
        • 1970-01-01
        • 2012-12-30
        • 1970-01-01
        • 2012-10-17
        相关资源
        最近更新 更多