Install Composer in Windows 2012

Asked

Viewed 100 times

0

My operating system has two Apaches running two phps (5 and 7.1 respectively). I am trying to install Composer for PHP7, but it is giving the following message:

The PHP exe file you specified Did not run correctly: C: PHP7 php.exe

The php.ini used by your command-line PHP is: C: PHP5 php.ini

A Setting in your php.ini could be causing the problem: Either the 'extension_dir' value is incorrect or the dll does not exist.

If I type in localhost:81 which is port for php7 it works normal bringing phpinfo, but in Composer gives error.

inserir a descrição da imagem aqui

If I try for the command line it is as if openssl is not activated, but it is

Gives the following message when trying the command below:

php -r "copy('https://getcomposer.org/installer', 'Composer-setup.php');"

Warning: copy(): Unable to find the wrapper "https" - Did you Forget to enable it when you configured PHP?

  • 1

    Delete the php5 installation

  • But I need both

  • 1

    But even so, it worked, I cut the folder of PHP5 to another and tried again and it worked so I went back again the folder of PHP5, and it worked normally, thanks

  • From what I understand you need to force the call to php.ini from php 7, you should have an environment variable defined with the installation of php5. Check the environment variables

  • but it was precisely in the environment variables php7

  • @lazyFox add your comment as a reply to Apague a instalação do php5

  • A weak bit the answer, but soon it is recorded.

Show 2 more comments

2 answers

1


Delete the php5 installation, there is a conflict in the php.ini call

1

No need to delete php5, except if it is deleted then you will not be able to test in your Apache with it.

The problem is that probably both versions of PHP are in the variable PATH of environment variables and/or user variables, example:

variaveis de ambiente no windows

I personally recommend that you review both user variables how much system variables, because if you have PHP5 and PHP7 at the same time it will complicate even.

So the ideal would be to use only one or the other in the variables, in case I think you want to use PHP7, then remove everything that has to do with php5 user variables and system variables (log out and log in again to make sure you update everything).

  • Actually I’d like to use both

  • @adventistaam but this will not prevent you from using both, you can install Composer normally for 7 and still have php5 in apache, only Composer will install PHP7-based packages.

  • but I had already taken php5 from the environment variables

  • @adventistaam unless you want to have "2 Composers", something like typing composer7 update composer5 update

  • @adventistaam has variable environment and variable system, as I showed in the image, you have to copy the paste fields in the notepad and look calmly.

  • Ahhh that did not know.. then it would be possible to use both Laravel 5.3 and 5.6?

  • @adventistaam if your wish is to have 2 Composers, yes but it will be a manual job to install two versions, and that is not the question here, I believe. So yes, it would be possible to install 2 Composers for different versions of PHP, which would depend on some manual effort, maybe one hour I formulate a step-by-step for windows.

  • 1

    @adventistaam my answer here already formulated is just to say, "do not need to exclude php5 to use the Composer in php7", because as the other answer you were obliged to this, which "independent" from the Commodore you had to do and it really wasn’t something necessary.

  • 1

    I agree with @Guilherme, it is only necessary to remove the association to an installation so as not to confuse the "Composer". In this case php5, but may continue to make use of it.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.