Abdullah Faraz
Abdullah Faraz

Reputation: 35

showing two different PHP versions in command line

I installed laravel project 5.1 which is working fine but artisan commands are not working throwing each() error which is deprecated in php 7.1. When I run phpinfo() it shows php version 5.6 and on command line there's also two versions are showing

when run

phpinfo();
5.6

when run on command Line in xampp folder

C:/xampp> php -v;
5.7

when run in command in this xammpp/php directory

C:/xampp/php> php -v;
5.6

Upvotes: 0

Views: 2029

Answers (1)

icy
icy

Reputation: 1446

This is because there are CLI version and WEB version.

How Giacomo1968 says in this answer on Super User:

“Don’t panic! If you are concerned about what PHP version your Apache server is using, the output of phpinfo() is always what you should pay attention to. The Apache PHP module and the PHP command line binary are two different things that don’t interfere with each other.

In fact you can compile and load various PHP versions you want to work with Apache as long as you adjust Apache to properly load it. The PHP command line interface will never come into play in the case of Apache parsing PHP pages.

The command line version of PHP is simply there for command line specific tasks and the PHP module for Apache will never touch, use or need that.”

Upvotes: 1

Related Questions