Search code examples
phpmacportsapache2.4macos-mojavephp-7.3

Use MacPorts PHP-FPM instead of from build


I've used MacPorts to install apache2, php73 and php73-fpm on MacOS Mojave. I've updated by .bash_profile to reflect the new MacPorts paths like so:

export PATH="/opt/local/bin:/opt/local/sbin:$PATH"

I've refreshed my .bash_profile by running:

. ~/.bash_profile

Running which php and which httpd in Terminal both output the correct paths:

/opt/local/bin/php
/opt/local/sbin/httpd

And running php -v and httpd -v both indicate that the MacPorts Apache and PHP are running.

However, I can't switch to the MacPorts php73-fpm that I installed. which php-fpm still returns the default OS build path:

/usr/sbin/php-fpm

How can I get the MacPorts php73-fpm running instead of the build php-fpm?


Solution

  • First thing to do is to check port's content:

    $ port contents php73-fpm
    Port php73-fpm contains:
      /Library/LaunchDaemons/org.macports.php73-fpm.plist
      /opt/local/etc/LaunchDaemons/org.macports.php73-fpm/org.macports.php73-fpm.plist
      /opt/local/etc/php73/php-fpm.conf.default
      /opt/local/etc/php73/php-fpm.d/www.conf.default
    ! /opt/local/sbin/php-fpm73
      ...
    

    So, as we can see port's executable is called php-fpm73, not php73-fpm