Skip to content

Conversation

@botantony
Copy link
Member

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Signed-off-by: botantony <antonsm21@gmail.com>
Signed-off-by: botantony <antonsm21@gmail.com>
@botantony
Copy link
Member Author

I do not like that Whalebrew Bundle test may not pass for an unknown reason

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @botantony! Can you detail at least 3+ formulae the will use/need this?

@botantony
Copy link
Member Author

botantony commented Mar 31, 2025

mysql-search-replace (see Homebrew/homebrew-core#217129)

Other formulae work fine but I still think it would be nice to explicitly define Homebrew's PHP in shebang. F.e.:

  • wp-cli
  • phpunit
  • phpbrew

There are also formulae like psalm or php-cs-fixer. Might be useful to add something like write_php_exec_script method which creates a file with

#!#{php_path}
<?php require '#{libexec_path}';

@MikeMcQuaid
Copy link
Member

Other formulae work fine but I still think it would be nice to explicitly define Homebrew's PHP in shebang.

What happens without this defined explicitly?

@botantony
Copy link
Member Author

If the formula is not compatible with the newest version yet (which happens with every new major PHP update) /usr/bin/env php may use wrong PHP version

@botantony
Copy link
Member Author

Here's an example from the core repository:
Migration to PHP 8.4.1 (Homebrew/homebrew-core#198473) broke some binaries. To fix this maintainers had to write a wrapper script to run them in legacy PHP version (instead of /usr/bin/env php). This could be fixed by using rewrite_shebang which automatically detects correct PHP version and uses it in shebangs

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @botantony!

@MikeMcQuaid MikeMcQuaid added this pull request to the merge queue Apr 1, 2025
Merged via the queue into Homebrew:master with commit ce720c1 Apr 1, 2025
69 checks passed
@botantony botantony deleted the php-shebang branch April 1, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants