Skip to content

Conversation

ewilly
Copy link
Contributor

@ewilly ewilly commented Oct 3, 2025

The problem

current default php version for ynh is 7.4 and does not rely to default debian php version

Solution

retrieve the debian default php version and use it
(not sure that the curl command is the best way but it's a working idea)

PR Status

...

How to test

I use it here : https://github.com/YunoHost-Apps/zwiicms_ynh/blob/1c96e467db03d66f1c17b90483fe5ae5ee2c4cdf/manifest.toml#L75

@ewilly
Copy link
Contributor Author

ewilly commented Oct 3, 2025

DEBIAN_DEFAULT_PHP_VERSION=$( apt-cache depends php | grep -Eo "php[0-9].[0-9]" | sed "s@^php@@" ) is perhaps a proper way ?


# (this is used in the apt helpers, big meh ...)
readonly YNH_DEFAULT_PHP_VERSION=8.2
DEBIAN_DEFAULT_PHP_VERSION=$(apt-cache depends php | grep -Eo "php[0-9].[0-9]" | sed "s@^php@@")
Copy link
Member

Choose a reason for hiding this comment

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

Uuuuuuh wokay but apt-cache is not free (it takes 1.5s to run this command on my desktop computer so I'd expect even more on a low-end ARM board) yet sourcing the helpers happens quite frequently and it's just way faster to hardcode the value considering it only changes between major debian versions ? x_x

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hum right, that something I didn't consider...
The main idea was to avoid something like :
if [[ $YNH_DEBIAN_VERSION == "bookworm" ]]; then readonly YNH_DEFAULT_PHP_VERSION=8.2 elif [[ $YNH_DEBIAN_VERSION == "trixie" ]]; then readonly YNH_DEFAULT_PHP_VERSION=8.4 fi

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