ThomH
ThomH

Reputation: 548

How to upgrade php version on Windows 10

I'm trying to get my Laravel project to work. But when I use composer update it says the following:

This package requires php >=5.6.4 but your PHP version (5.5.12) does not satisfy that requirement.

I'm using WAMP which runs php version 7.0.4 this is also confirmed in the browser if I echo the php version. But when I use php -v in the console it shows that I'm using PHP version 5.5.12 (cli).

I've searched a bit around on google and I found out that it uses my windows PHP version instead of my webserver's version. But I couldn't find out how to update my PHP version on Windows.

My PATH contents are as shown in the following image

enter image description here

Upvotes: 33

Views: 130123

Answers (6)

Follow these steps if you want to upgrade your PHP version.

First, I assume you have your php folder on your C drive, or somewhere else. I assume you also have the folder listed in your environment variable path.

Head to the PHP website, and select the version that you want. Download the source code version.

Once you’ve downloaded it, head back to the old php folder, and rename it to something other than php, why? We will extract our freshly downloaded php into the php folder.

Now, we’re almost there! Head into the folder, and rename the php.ini-development or php.ini-production file into php.ini (we’re going to need php.ini for the configuration) and while we’re at it, configure the extensions as it will be used especially during development.

Now we’re all good! You can test it by going to your terminal and typing php -v.

Upvotes: -1

Ercan Koca
Ercan Koca

Reputation: 11

First you need to download the php version. Then you need to add the php version file you downloaded to system properties / advanced / environment variables / system variables / path for windows.

Upvotes: 0

Julien J
Julien J

Reputation: 87

To update PHP on Windows 10.

You must put the folder of the new PHP version in the same folder as the old. You rename the old folder or you delete it, prefer rename the old folder, now you write in a terminal console

php - v

PHP automatically check for a new version

Upvotes: 3

alexanderesmar
alexanderesmar

Reputation: 51

if you had installed before xampp/wampp and composer globally you might had added php to you environment path to call it where ever you want, and now you want that composer use the new xampp with php the you recently installed, so go to system>advance tab> environment variable> maybe in PATH then search if you have something like C:\xampp\php and edit to your new php location.

I had multiple versions off xampp for testing and composer globaly instaled for php 7.2

Upvotes: 1

Moe Ismail Alhakeem
Moe Ismail Alhakeem

Reputation: 435

You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.

enter image description here

Upvotes: 43

Huzaib Shafi
Huzaib Shafi

Reputation: 1138

This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation.

However, you can modify your PATH environment variable as well. Procedure

Just remove the path that points to any PHP installation directory.

Else, otherwise, if you are unsure about changing the PATH variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH variable points to.... (I mean the PHP directory)

The totally better solution is to add the path of your PHP7 bin directory at the beginning of the PATH variable. You should also make available composer in this PHP7 bin directory.

Such as, replace the C:\php in your path with C:\wamp\bin\php7 or whatever the location of the PHP7 path is..

Upvotes: 5

Related Questions