0

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

1 Answer 1

1

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.”

Sign up to request clarification or add additional context in comments.

2 Comments

i command line there's also two versions and when running laravel artisan command php 7.1 version is breaking everything
try to look in php.ini or php_info() where is your php.exe used for web version. I'm assuming u're using windows environment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.