I recently upgraded php to 5.5.6, but can't get "php-fpm" to refer to the proper binary.

$ php-fpm -v
5.3.27
$ /usr/local/sbin/php -v
5.5.6
$ echo $PATH
/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:…
$ ls /usr/local/mysql/bin/php-f*
ls: /usr/local/mysql/bin/php-f*: No such file or directory
$ ls /usr/local/bin/php-f*
ls: /usr/local/bin/php-f*: No such file or directory

As far as I understand these things, the only way "php-fpm" could match anything other than the link in /usr/local/sbin would be if there was another "php-fpm" in either /usr/local/mysql/bin or in /usr/local/bin, based on the contents of the $PATH variable. "which" seems to agree with me

$ which php-fpm
/usr/local/sbin/php-fpm

But since "which" and I obviously are mistaken, I really have no clue as to how all this works.

I realize that I may specify a full path in the web server conf, but I really would like to understand how the "magic file target selection process" works.

I also realize that I could remove the old php version - but I honestly wouldn't even know where to begin, since I have no idea where to find all the php stuff shipped with the system by default would be stored. Besides, it seems unnecessary if the rest is done properly.

    Do you have file(1) ?

    $file `which php-fpm`

    might shed a little light....

      What is the output of where php-fpm and /usr/local/sbin/php-fpm -v ?

        dalecosp;11035489 wrote:

        Do you have file(1) ?

        $file `which php-fpm`

        Yes, file seems to exist. I didn't even know it was a command. I've never had to deal with any system administration previously so my skill is somewhere between nonexistent and crap.

        $ file `which php-fpm`
        /usr/local/sbin/php-fpm: Mach-O 64-bit executable x86_64
        
          bradgrafelman;11035497 wrote:

          What is the output of where php-fpm and /usr/local/sbin/php-fpm -v ?

          -bash: where: command not found
          

          Perhaps "whereis" represents the corresponding command you want? If so

          $ whereis php-fpm
          /usr/sbin/php-fpm
          

          This is indeed the old php-fpm. But the symlink that I created in usr/local/sbin does not link to this file

          bradgrafelman;11035497 wrote:

          and /usr/local/sbin/php-fpm -v ?

          5.5.6, or if the whole thing sheds any more light on the issue

          $ /usr/local/sbin/php-fpm -v
          PHP 5.5.6 (fpm-fcgi) (built: Nov 19 2013 16:32:46)
          Copyright (c) 1997-2013 The PHP Group
          Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
              with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
          

          Which is the same as directly referencing the binary at /usr/local/Cellar/php55/5.5.6/sbin/php-fpm

            Well, I was hoping to find that maybe the php-fm that which could find was a wrapper script; the BSDen sometimes do this (and OSX has some roots here).

            However, that doesn't seem to be the case. I might recommend mv'ing the "old" php-fm to "php-fm.old" or somesuch and trying to make a symlink again, or even just trying to see if mv'ing it (so the shell doesn't find it in the old location) would allow the shell to run the new one...

              In short, renaming once, testing and then renaming back to the original name made things work, while looking exactly as they did when it didn't work. It would be nice if anyone can shed some light on why (seemingly) identical configurations lead to differnet outcomes.

              I did

              $ php-fpm -v
                 5.3.26
              $ mv /usr/sbin/php-fpm /usr/sbin/php-fpm-5.3
              $ php-fpm -v 
                 5.5.6
              $ mv /usr/sbin/php-fpm-5.3 /usr/sbin/php-fpm
              $ php-fpm -v
                 5.5.6
              

              In reality I did try some path changes as well before I realized that the behaviour was back to normal. After the initial renaming, I discovered duplicate entries of /usr/local/sbin in $PATH. The first before /usr/sbin and the second after. I.e.

              $ echo $PATH
                 /usr/local/sbin:/usr/sbin:/usr/local/sbin
              

              I speculated that perhaps only the last identical path entry was respected, so I renamed php-fpm-5.3 back to /usr/sbin/php-fpm. Then I removed the last entry of /usr/local/sbin from $PATH. To achieve this, I had to edit ~/.MacOSX/environment.plist and reboot the computer. I tried "php-fpm" and it found 5.5.6. Then I once again specified double entries for /usr/local/sbin and tried "php-fpm" again. But it still found 5.5.6.

                Thanks for the help. While I still don't understand what went wrong initially or why, at least you helped me get things in order so I can mark the thread resolved.

                And as a side note: This question in this thread was not meant to suggest that anyone should actually rely on $PATH for automated execution. Always use full paths for that.

                  Write a Reply...