I would like to get the current numerical value for php in the php.ini path. I understand that php -v gets me a bunch of info, but I just need the "7.2" or whatever the current version is from the php.ini path.
Edit: I'm building an automation script and if the version changes, I need to be able to know what was installed when I ran apt-get install php
This script gets me the line i care about:
php --ini | grep Loaded | cut -d' ' -f12
The result (as of today) is
/etc/php/7.2/cli/php.ini
Whats the best in bash way to echo "7.2" assuming that the /etc/php will not change (its unlikely based on the history of where php installs using apt-get)
I'm open to other methods that don't involve php --ini, I just need the 7.2 (or whatever that path value may morph into).
php --version?php_dev=php$php_version-dev, apt-get -y install $php_dev. I'm building an automation script and if the version changes, I need to be able to know what was installed when I ranapt-get install php