简体   繁体   English

如何安装PHP扩展以满足作曲家?

[英]How can I install PHP extensions to satisfy composer?

I am creating a app and am trying to install a library into my project though composer. 我正在创建一个应用程序,并试图通过作曲家将库安装到我的项目中。

Composer has given me the error: 作曲家给了我错误:

Problem 1 - The requested PHP extension ext-gmp * is missing from your system. 问题1-您的系统缺少所要求的PHP扩展名ext-gmp *。 Install or enable PHP's gmp extension. 安装或启用PHP的gmp扩展。

Ok, it seems like I need to gmp extension. 好的,看来我需要gmp扩展。

I am using a Mac, and using a local test server with XAMPP. 我正在使用Mac,并在XAMPP中使用本地测试服务器。

Now this is where it starts getting confusing. 现在,这开始变得令人困惑。 I went to my XAMPP php.ini and remove the ";" 我去了XAMPP php.ini并删除了“;” from gmp extension like this: xampp attempt 从gmp扩展中这样: xampp尝试

I retried composer installation with no luck. 我重试了作曲家的安装,但是没有运气。 My next thought was that the extension needs to be installed on the global PHP Mac installation... I removed the ";" 我的下一个想法是,扩展名需要在全局PHP Mac安装中安装...我删除了“;”。 for gmp on that php.ini, but no luck. 对于该php.ini上的gmp,但没有运气。 How can I solve this? 我该如何解决?

-if you need it for php 5 use -如果您需要它供php 5使用

   brew install homebrew/php/php55-gmp

-if you need it for php 7 use -如果您需要它供php 7使用

   brew install homebrew/php/php70-gmp

-and if you don't have homebrew, you can install it using this command -并且如果您没有自制软件,则可以使用以下命令进行安装

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

OR you can jsut run 或者你可以jsut运行

   brew install php@7.1

since it have all the packages you need for php 7.1 由于它具有php 7.1所需的所有软件包

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

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