Switch PHP-cli version under windows

concept:

PHP-cli is the abbreviation of PHP Command Line Interface, which refers to the command line interface of PHP. It is an execution method in the PHP language, which can run PHP programs under the command line without executing through a web server or browser.

PHP-cli can be used in many scenarios, such as:

  1. Writing scripts: PHP-cli can easily write various types of scripts, such as system management, file processing, data processing, etc.
  2. Executing scheduled tasks: Use PHP-cli to easily perform various scheduled tasks, such as backing up data, generating reports, sending emails, etc.
  3. Debugging program: PHP-cli can easily debug PHP programs, and quickly locate and solve problems by outputting debugging information under the command line.

PHP-cli supports many common command line options and parameters, and can use various language features and function libraries of PHP. It has high flexibility and scalability, and is an important part of PHP development.

First, windows+r enter cmd to open the cmd command line and enter php -v to view the current version of php-cli

 

It can be seen that the current php-cli version is PHP 5.6.40

Next we start to switch the php-cli version

1. First find the directory where PHP is installed

The PHP environment I use is Wampserver
2. Right-click on my computer to open properties and open advanced system settings

 

 Then open the environment variable

 

You will see the directory path of the current PHP-cli version

 

 3. Next, add the PHP version you need to run as PHP-cli and then move the added PHP path up to the path of the current PHP version

 

4. Save changes

 

5. Reopen the command line and enter php -v

 

php-cli version switching is complete!

Guess you like

Origin blog.csdn.net/MrWangisgoodboy/article/details/129929659