Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add multiple php variables in environment variable i.e path

Tags:

php

apache

Well, I have previously installed PHP 5.3.28 from executable which installed it on my machine, globally with entries in the path variable as:

path ...;C:\php\php53\;...

and another variable as:

PHPRC C:\php\php53

This PHP is configured with Apache 2.2.Running PHP -v from command line results in the version of PHP

enter image description here

After some time I needed to upgrade my versions of PHP (to 5.6) and Apache (to 2.4) and I downloaded them as archived packages and configured them. So now I have two separately configured sets of PHP and Apache. Both of them are working fine, and i also added new PHP 5.6 into my environmental variables but it is not recognizing it.

enter image description here

My environmental variables are:

enter image description here

I also added C:\php\php56\ to path also ahead of red line.But its not working.I require both of these versions of php.exe's.

like image 926
Ali Malik Avatar asked Dec 24 '15 13:12

Ali Malik


People also ask

How can we add multiple values to PATH in environment variable?

In the Environment Variables window (as shown below), highlight the Path variable in the System Variable section and click the Edit button. Add or modify the path lines with the paths you want the computer to access. Each different directory is separated with a semicolon, as shown below.

How do you add to the variable environment PATH?

To add a path to the PATH environment variableIn the System dialog box, click Advanced system settings. On the Advanced tab of the System Properties dialog box, click Environment Variables. In the System Variables box of the Environment Variables dialog box, scroll to Path and select it.

Can I use .ENV in PHP?

An . env file is a plain text file which contains environment variables definitions which are designed so your PHP application will parse them, bypassing the Apache, NGINX and PHP-FPM. The usage of . env files is popular in many PHP frameworks such as Laravel which has built-in support for parsing .


1 Answers

Make sure you have php56.exe present in "c:\php\php56\" i.e. "c:\php\php56\php56.exe". You can rename php.exe to php56.exe to test.

Have you also restarted you cmd prompt? Environment variables (the path) do no update inside of an active cmd prompt unless they are edited only within the command prompt.

You can also try calling c:\php\php56\php.exe with a full path to make certain it is working regardless of paths.

like image 199
Kyle Wiering Avatar answered Sep 19 '22 17:09

Kyle Wiering