简体   繁体   中英

Windows 10 can't use AWS SDK for PHP v3 with Composer

I'm a student and pretty new to web development so forgive me if I'm missing something obvious. I recently attended a hackathon and was on a team with experienced developers who were building an app for deployment on AWS using the the Silex framework. Everyone else was using a Mac, while I have a PC running Windows 10. When they integrated AWS PHP SDK v3 from packagist I was unable to run the composer update function from the command line - I kept getting the following message:

Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - aws/aws-sdk-php 3.3.5 requires php >=5.5 -> your PHP version (5.4.24) or " config.platform.php" value does not satisfy that requirement.

Because I was unable to run the composer update function, I wasn't able to update my app code and I couldn't continue to work on the project. This was frustrating, but I'm also just very confused about how to update PHP on my computer... I downloaded the zip file for PHP 5.6.13-nts and followed all the instructions I could find online for placing it in a folder structure, I also updated IIS so I can run phpinfo() on localhost and see that I have version 5.6.13 - yet when I try to run the composer update it still says I have PHP 5.4.24.

If anyone has any advice on this issue I'd appreciate it. Here's the version of the AWS SDK that's referenced above:

https://packagist.org/packages/aws/aws-sdk-php-silex

Welcome to StackOverflow, Blake!

It seems that you have multiple PHP versions installed and the CLI command php composer.phar ... uses php.exe from the old version. My guess is that the old version is still on the env path.

I suggest to check your environment path to find out, if the path to the old version of PHP is still added there. If so, simply replace it by the path to the new PHP version. And then execute a simple php -v on the CLI to see, if the new version is used. After that Composer should run fine.

You reach the dialog to change the environment variables by pressing Win Break , then select "Advanced system settings", then "Environment Variables", then "Path".

(Sidenote and shameless plug: there are pre-configured web development stacks for Windows out there: WPN-XM or XAMPP , just to name a few. They are made to save developers some time, instead of doing software installation and configuration. Some of them ship Composer and other tools relevant for development with PHP right out of the box.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM