简体   繁体   English

Windows 10 无法将 AWS SDK for PHP v3 与 Composer 结合使用

[英]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.我是一名学生,对 Web 开发还很陌生,所以如果我遗漏了一些明显的东西,请原谅我。 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.我最近参加了一个黑客马拉松,并与经验丰富的开发人员组成了一个团队,他们正在使用 Silex 框架构建要在 AWS 上部署的应用程序。 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:其他人都在使用 Mac,而我有一台运行 Windows 10 的 PC。当他们从 packagist 集成 AWS PHP SDK v3 时,我无法从命令行运行composer update功能 - 我不断收到以下消息:

Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages.使用包信息加载 Composer 存储库 更新依赖项(包括 require-dev) 您的需求无法解析为一组可安装的包。 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.问题 1 - aws/aws-sdk-php 3.3.5 需要 php >=5.5 -> 您的 PHP 版本 (5.4.24) 或“config.platform.php”值不满足该要求。

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.因为我无法运行 composer update 功能,所以我无法更新我的应用程序代码,也无法继续处理该项目。 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.这令人沮丧,但我也对如何在我的计算机上更新 PHP 感到非常困惑......我下载了 PHP 5.6.13-nts 的 zip 文件,并按照我可以在网上找到的所有说明将其放入文件夹中结构,我还更新了 IIS,所以我可以在本地主机上运行 phpinfo() 并看到我有 5.6.13 版本 - 但是当我尝试运行 composer update 时,它​​仍然说我有 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:这是上面引用的 AWS 开发工具包的版本:

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

Welcome to StackOverflow, Blake!欢迎来到 StackOverflow,布莱克!

It seems that you have multiple PHP versions installed and the CLI command php composer.phar ... uses php.exe from the old version.您似乎安装了多个 PHP 版本,并且 CLI 命令php composer.phar ...使用旧版本的php.exe My guess is that the old version is still on the env path.我的猜测是旧版本仍在 env 路径上。

I suggest to check your environment path to find out, if the path to the old version of PHP is still added there.我建议检查您的环境路径以找出是否仍然添加了旧版本PHP的路径。 If so, simply replace it by the path to the new PHP version.如果是这样,只需将其替换为新 PHP 版本的路径即可。 And then execute a simple php -v on the CLI to see, if the new version is used.然后在 CLI 上执行一个简单的php -v以查看是否使用了新版本。 After that Composer should run fine.之后 Composer 应该可以正常运行。

You reach the dialog to change the environment variables by pressing Win Break , then select "Advanced system settings", then "Environment Variables", then "Path".您可以通过按Win Break进入更改环境变量的对话框,然后依次选择“高级系统设置”、“环境变量”和“路径”。

(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.) (旁注和无耻的插件:有适用于 Windows 的预配置 Web 开发堆栈: WPN-XMXAMPP ,仅举几例。它们旨在为开发人员节省一些时间,而不是进行软件安装和配置。一些他们提供 Composer 和其他与 PHP 开发相关的工具,开箱即用。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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