John Davidson

ubuntu - Why does phpinfo() show version 7.4 but php -v show version 7.2.34?

0 comments
Message:


when I run a file with phpinfo() , then result is PHP Version 7.4
but command line run php -v, but result is PHP 7.2.34


PHP 7.2.34-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:15) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.34-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans

Why am I seeing the discrepancy?



My Answer:
The reason for the discrepancy between the PHP version shown in phpinfo() and the version shown in php -v could be due to the fact that you have multiple versions of PHP installed on your system.

When you run phpinfo() in a file, it is showing the version of PHP that is being used by your web server (e.g. Apache or Nginx), which may be version 7.4.

On the other hand, when you run php -v in the command line, it is showing the version of PHP that is being used by the command line interface, which may be version 7.2.34.

To resolve this issue, you may need to update the PHP version being used by the command line interface to match the version being used by your web server. You can do this by updating your PHP installation or configuring your system to use the desired version of PHP for both the web server and the command line interface.

Rate this post

5 of 5 based on 7027 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us