Subject: bug#76955: 30.1; php-ts-mode-php-executable default path may not match remote path

From: Vincenzo Pupillo <[email-masked]>
Date: Thu, 13 Mar 2025 15:07:41 +0100

In data giovedì 13 marzo 2025 12:26:03 Ora standard dell’Europa centrale, 
Morgan Willcock ha scritto:
> Vincenzo Pupillo <[email-masked]> writes:
> > 'php-ts-mode-php-executable' it's used for 'php-ts-mode-flymake-php',
> > 'run-php' and 'php-ts-mode-run-php-webserver'.
> 
> It was calling run-php where I initially found the problem.

Ok. 'run-php' can be invoked with C-u M-x run-php and you can specify the path 
to php. Sometimes I am forced to use older versions of php, Remi's php 
packages use a suffix to indicate the version, e.g. php54.

> 
> > @Morgan: Will setting the executable path to "php" work in your scenario?
> > Of the functions listed above, which one do you usually use?
> 
> Setting the value to "php" is how I use it, because that works
> everywhere I need it even though the local and remote setups have
> nothing in common.
> 
> Just to be clear, the "bug" I am reporting here is that the current
> default value seems to assume that the local PHP setup will be identical
> to a remote PHP setup, and that falling back to using a full path like
> "/usr/bin/php" makes similar and platform specific assumptions.
> 
> To work in more places without requiring customisation, I think the
> default value should be "php".
> 
> I cannot see any benefit in calling executable-find to set the default
> value because this seems at odds with using the major mode with TRAMP
> connections.
> 
> I see little benefit in "/usr/bin/php" as a default fallback value
> because it is very likely that the binary would have been automatically
> located in /usr/bin if that path exists.
> 
> If someone could explain the reasoning behind how the default value is
> currently being set, and why that is better than just using the value
> "php", feel free to close this bug report.

At first it was just 'php' then, since I don't know the details of how path 
resolution works on Windows or even Macs, I preferred to use 'executable-
find'. as in python.el for example. So, since I have always used 'php-mode' 
and wanted users to feel "at home", I used exactly the same expression: '(or 
(executable-find "php") "/usr/bin/php")'.

Vincenzo

> Thanks,
> Morgan
> --
> Morgan Willcock