4

I'm not using php or php-fpm, but it's hogging port 9000. I need port 9000. I'd like to change the port. I changed it in /etc/php-fpm.conf and /etc/php-fpm.d/www.conf. listen = 127.0.0.1:9005. Still listening on 9000. If I kill it it just loads back up instantly with a different PID.

I'm ok uninstalling it too, but I can't figure out how to do that either. Any ideas?

Brian Jenkins
  • 349
  • 1
  • 6
  • 22

2 Answers2

5

which php version do you have and did you install it via homebrew?

I was having this problem today and solved it by changing the configuration of the listening port:

in the config file in: /usr/local/etc/php/7.2/php-fpm.d/www.conf

change the line listen = 127.0.0.1:9000 to whatever port you want

If you don't have the config file it might have been a brew problem when copying files. You have to do something like this before attempting to change www.conf:

cd $(brew --prefix php@7.2) cp -R .bottle/* /usr/local/

All the credits go to this blogpost: https://www.dionysopoulos.me/custom-apache-and-php-server-on-macos-the-definitive-2019-edition/

2

Update for Apple Silicon Chips

Although the current answer is correct for Mac's on Intel chips it's not correct for changing the PHP-FPM Port on Mac with Apple Silicon chips.

If following the blogpost https://www.dionysopoulos.me/custom-apache-and-php-server-on-macos-the-definitive-2019-edition/

Do Not copy the brew files to /usr/local/ as this is for intel chips. Instead, after installing php with brew, the file should already exist in:

/opt/homebrew/etc/php/8.0/php-fpm.d/www.conf

Or for php 5.6: /opt/homebrew/etc/php/5.6/php-fpm.conf

Where you can then change listen = 127.0.0.1:9000 to the port you like.

Remember to then restart apache.

Jonathan Clark
  • 1,180
  • 1
  • 8
  • 26
  • For php 8.1 the path is /opt/homebrew/etc/php/8.1/php-fpm.d/ and for php 8.2 the path is /opt/homebrew/etc/php/8.2/php-fpm.d/ – Isaac Gregson Mar 15 '23 at 11:32