[RESOLVED] Which OSX binary - and why?
Results 1 to 8 of 8

Thread: [RESOLVED] Which OSX binary - and why?

  1. #1
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637

    resolved [RESOLVED] Which OSX binary - and why?

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

    Code:
    $ 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
    Code:
    $ 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.
    Last edited by johanafm; 11-20-2013 at 08:46 AM.

  2. #2
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,687
    Do you have file(1) ?
    Code:
    $file `which php-fpm`
    *might* shed a little light....
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  3. #3
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,399
    What is the output of `where php-fpm` and `/usr/local/sbin/php-fpm -v` ?

  4. #4
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637
    Quote Originally Posted by dalecosp View Post
    Do you have file(1) ?
    Code:
    $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.
    Code:
    $ file `which php-fpm`
    /usr/local/sbin/php-fpm: Mach-O 64-bit executable x86_64

  5. #5
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637
    Quote Originally Posted by bradgrafelman View Post
    What is the output of `where php-fpm` and `/usr/local/sbin/php-fpm -v` ?
    Code:
    -bash: where: command not found
    Perhaps "whereis" represents the corresponding command you want? If so
    Code:
    $ 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

    Quote Originally Posted by bradgrafelman View Post
    and `/usr/local/sbin/php-fpm -v` ?
    5.5.6, or if the whole thing sheds any more light on the issue
    Code:
    $ /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

  6. #6
    Settled 4 red convertible dalecosp's Avatar
    Join Date
    Jul 2002
    Location
    Accelerating Windows at 9.81 m/s....
    Posts
    7,687
    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...
    /!!\ mysql_ is deprecated --- don't use it! Tell your hosting company you will switch if they don't upgrade! /!!!\ ereg() is deprecated --- don't use it!

    dalecosp "God doesn't play dice." --- Einstein "Perl is hardly a paragon of beautiful syntax." --- Weedpacket

    Getting Help at All --- Collected Solutions to Common Problems --- Debugging 101 --- Unanswered Posts --- OMBE: Office Machines, Business Equipment

  7. #7
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637
    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
    Code:
    $ 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.
    Code:
    $ 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.

  8. #8
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637
    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •