shivammathur / homebrew-php

:beer: Homebrew tap for PHP 5.6 to 8.4. PHP 8.4 is built nightly.

Home Page:https://github.com/shivammathur/homebrew-php/packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plists generated via service blocks are broken

vintagesucks opened this issue · comments

Describe the bug
The service plists are broken since they get generated via service blocks.

PHP versions
All of them, but I'll focus on 8.0 in this bug report.

To Reproduce

brew install shivammathur/php/php@8.0
brew services start shivammathur/php/php

Expected behavior
~/Library/LaunchAgents/homebrew.mxcl.php.plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>homebrew.mxcl.php</string>
    <key>ProgramArguments</key>
    <array>
      <string>/opt/homebrew/opt/php/sbin/php-fpm</string>
      <string>--nodaemonize</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/opt/homebrew/var</string>
    <key>StandardErrorPath</key>
    <string>/opt/homebrew/var/log/php-fpm.log</string>
  </dict>
</plist>

Notice how ProgramArguments is an array and includes --nodaemonize.

Screenshots/Logs
Since the recent change to generate plists via service blocks the generated plist looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>homebrew.mxcl.php</string>
	<key>ProgramArguments</key>
	<string>/opt/homebrew/opt/php/sbin/php-fpm</string>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardErrorPath</key>
	<string>/opt/homebrew/var/log/php-fpm.log</string>
	<key>WorkingDirectory</key>
	<string>/opt/homebrew/var</string>
</dict>
</plist>

No ProgramArguments array, no --nodaemonize. Starting the service fails:

brew services start shivammathur/php/php 
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/nikolas/Library/LaunchAgents/homebrew.mxcl.php.plist` exited with 5.

Additional context

brew config:

HOMEBREW_VERSION: 3.1.4-24-g8d35744
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8d3574458178bf1594475444986b44171a7c527e
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 99a41050d89b6983a9f5aa310cf79a0f7218b568
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1205
Git: 2.31.1 => /opt/homebrew/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.2.3-arm64
CLT: 12.5.0.0.1.1617976050
Xcode: N/A
Rosetta 2: false

Are you willing to submit a PR?
Sure.

@vintagesucks
I have reverted 919b5af till there is a fix upstream.

Reverted to fix my issue here

@asentner No I reverted the change in this tap, httpd in the core tap will be fixed once Homebrew/brew#11279 gets merged.

Fixed upstream. Reverted the revert 😅

Hi,

I came across the same problem when running brew services start php@7.2

Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/502 ~/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist` exited with 5.

plist looks like this:

	<key>ProgramArguments</key>
	<array>
		<string>/opt/homebrew/opt/php@7.2/sbin/php-fpm</string>
		<string>--nodaemonize</string>
	</array>