How do i change php version in windows terminal? 2022

How do i change php version in windows terminal? 2022

Thủ Thuật Hướng dẫn How do i change php version in windows terminal? 2022


Bạn đang tìm kiếm từ khóa How do i change php version in windows terminal? được Cập Nhật vào lúc : 2022-10-01 23:20:24 . Với phương châm chia sẻ Bí quyết Hướng dẫn trong nội dung bài viết một cách Chi Tiết 2022. Nếu sau khi đọc nội dung bài viết vẫn ko hiểu thì hoàn toàn có thể lại Comments ở cuối bài để Mình lý giải và hướng dẫn lại nha.


Old question I know, but just to add some additional information:


Nội dung chính


  • Access

    Environment Variables

  • Change PHP cli version path

  • Troubleshoot

  • Still see the old PHP CLI version in your terminal?

  • Have many PHP versions in System variables

  • How do I update PHP version in terminal?

  • How do I switch between multiple PHP versions in Windows?

  • How do I change the default PHP in Windows?

  • What version of PHP do I have terminal windows?

  • WAMP is used only on Microsoft Windows Operating Systems.

  • Changing the version of PHP used through the left-click -> PHP -> Version menu changes the version used by Apache to server your site.

  • Changing the version of PHP used through the right-click -> Tools -> Change PHP CLI Version menu changes the version used by WAMP’s PHP CLI.

Note: It

is important to understand that the “PHP CLI Version” is used by WAMP’s own internal PHP scripts. This “PHP CLI Version” has nothing to do with the version you wish to use for your scripts, Composer or anything else.


For your scripts to work with the version you require, you need to add it’s path to the Users Environmental Path. You could add it to the Systems environmental Path but the Users Path is the recommended option.


From WAMP v3.1.2, it would display an error when it detect

reference to a PHP path in the System or User Environmental Path. This was to stop confusion such as you were experiencing. Since v3.1.7 the display of this error can now be optionally displayed through a selection in the WampSettings menu.


As indicated in previous answers, adding an installed PHP path (such as “C:wamp64binphpphp7.2.30”) to the Users Environmental Path is the correct approach. PS: As the value of the Users Environmental Path is a string, all paths added must be

separated with a semi-colon (;)


After experiencing the exact same problem (IE: Choosing which version of PHP I wanted Composer to use), I created a script which could easily and rapidly switch between PHP CLI Versions depending on what project I was working on.


The Windows batch script “WampServer-PHP-CLI-Version-Changer” can be found

https://github.com/custom-dev-tools/WampServer-PHP-CLI-Version-Changer


I hope this helps others.


Good luck.



Recently, I am building an trực tuyến store with Laravel 8. In order to work with Laravel 8, I need to upgrade my PHP CLI. Right now, I have PHP 7.1.33 (CLI) on my computer. You can check your own PHP CLI the terminal as below.


$ php -v

PHP 7.1.33 (cli) (built: Oct 23 2022 09:24:14) ( ZTS MSVC14 (Visual C++ 2015) x64 )

Copyright (c) 1997-2022 The PHP Group

Zend Engine v3.1.0, Copyright (c) 1998-2022 Zend Technologies


Now

I will head to the environment variables and change the PHP CLI path in the System variables section. This is how I set up my environment development for all PHP web applications and WordPress. This way, I can access PHP CLI, composer, nodejs, and more from anywhere on my computer.


Access

Environment Variables


To access the environment variables, you just search the “environment variable” keyword from the search icon on the taskbar. Below is where to access environment variables.


How do i change php version in windows terminal?Environment Variables for Windows


After clicking on the Environment Variables button, you will see this popup.


How do i change php version in windows terminal?Edit environment variables


Change PHP cli version path


You will edit the Path variable. Basically, you just add the PHP CLI version you want into the Path variable.


How do i change php version in windows terminal?


For me, I have a bunch of PHP versions in

WampServer including PHP 7.4.0. In order to change the PHP CLI version, in my case, I just edit the PHP path from 7.1.33 to 7.40.


Here is my Path variable, I change from “E:wamp64binphpphp7.1.33” to “E:wamp64binphpphp7.4.0“.


Now, you will kill all the opened terminals if you leave them open, and reopen VSCode again. Then

check the PHP CLI version by the command line below. You should see the PHP CLI version you just change in the System variables now.


$ php -v

PHP 7.4.0 (cli) (built: Nov 27 2022 10:14:18) ( ZTS Visual C++ 2022 x64 )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies


Troubleshoot


Still see the old PHP CLI version in your terminal?


If you still see the PHP CLI old version in the terminal, make sure you terminate the opened terminal (bash terminal) in VScode and open a new terminal. Then check the PHP

CLI version on the new terminal.


Have many PHP versions in System variables


If you have more than one PHP version are set in the System variables, you just move the PHP version you want to use and move it above other PHP versions. So that the terminal can pick the first PHP version from the System variables.


How do I update PHP version in terminal?


In short what you need to do is:. Ensure the php packages for the version you want are installed.. Update any configuration for that PHP version.. Update your web server configuration to point to the correct PHP version.. Point PHP CLI to the correct PHP version.. Restart your web server and php-fpm.. Mask the old php-fpm daemon..


How do I switch between multiple PHP versions in Windows?


Steps to change port:. Change the config file for the MySQL in “my. ini” file.. Change the port to 3307.. Run the code: PHP. … . Save the above code in “htdocs” thư mục of the XAMPP thư mục for the new and older version.. Save in “htdocs” thư mục of the XAMPP thư mục.. Similarly with XAMPP_1_8_2..


How do I change the default PHP in Windows?


I found a very easy way to switch php versions:. Search for system environment variable.. Click on “Environment variables”. Under “System variables” select path and click on edit.. Move the PHP version thư mục you want to use before the other one. So for example: php 7.0 will now be used:.


What version of PHP do I have terminal windows?


1. Type the following command, replacing [location] with the path to your PHP installation. 2. Typing php -v now shows the PHP version installed on your Windows system.

Tải thêm tài liệu liên quan đến nội dung bài viết How do i change php version in windows terminal?


programming

php

Multiple php xampp

Alias php version


How do i change php version in windows terminal?Reply
How do i change php version in windows terminal?1
How do i change php version in windows terminal?0
How do i change php version in windows terminal? Chia sẻ


Share Link Cập nhật How do i change php version in windows terminal? miễn phí


Bạn vừa Read tài liệu Với Một số hướng dẫn một cách rõ ràng hơn về Review How do i change php version in windows terminal? tiên tiến và phát triển nhất ShareLink Tải How do i change php version in windows terminal? Free.



Thảo Luận vướng mắc về How do i change php version in windows terminal?


Nếu sau khi đọc nội dung bài viết How do i change php version in windows terminal? vẫn chưa hiểu thì hoàn toàn có thể lại phản hồi ở cuối bài để Admin lý giải và hướng dẫn lại nha

#change #php #version #windows #terminal

Related posts:

Post a Comment

Previous Post Next Post

Discuss

×Close