Using “php -i | grep ”Loaded plugins|PHP Version “ | tail -n2”, nothing show

I hear about that PHP 7.4.x supports MySQL 8. And read this article, I follow its instructions and use command:

php -i | grep "Loaded plugins|PHP Version " | tail -n2

But nothing appear.

I try again this:

php -i | grep "Loaded plugins|PHP Version "

Nothing appear either.

I try to use

php -i

This time there are a lot of lines and it is rather difficult to check each of them.

So why “php -i | grep “Loaded plugins|PHP Version ” | tail -n2″ not working?


You should tell grep to interpret “Loaded plugins|PHP Version ” as an extended regular expression.

 php -i | grep  -E "Loaded plugins|PHP Version" | tail -n2

PHP Version => 8.0.8
Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_caching_sha2_password,auth_plugin_sha256_password