简体   繁体   English

安装Composer失败,出现“缺少openssl扩展”错误

[英]Install Composer fails with “The openssl extension is missing” error

I'm attempting to install Composer but I get the following error: 我正在尝试安装Composer,但是我收到以下错误:

"Some settings on your machine make Composer unable to work properly. Make sure that you fix the issues listed below and run this script again: “计算机上的某些设置使Composer无法正常工作。请确保修复下面列出的问题并再次运行此脚本:

The openssl extension is missing, which means that secure HTTPS transfers are impossible. 缺少openssl扩展,这意味着无法进行安全的HTTPS传输。 If possible you should enable it or recompile php with --with-openssl" 如果可能的话你应该启用它或用--with-openssl重新编译php“

I have then gone into my php.ini-production and uncommented: "extension=php_openssl.dll" 然后我进入我的php.ini-production并取消注释:“extension = php_openssl.dll”

This still doesn't work though, is there something else I have to do? 这仍然不起作用,还有什么我必须做的吗?

I suspect "php.ini-production" is a dummy configuration file suitable for live environments. 我怀疑“php.ini-production”是一个适合现场环境的虚拟配置文件。 Do a php -i at the console and find the 'php.ini' path, to see where it is expecting the ini file to be kept. 在控制台上做一个php -i并找到'php.ini'路径,看看它希望保留ini文件的位置。 This is normally expecting "php.ini", and may not actually exist - if it does not, copy php.ini-development (or similar) to the location required. 这通常是期待“php.ini”,并且实际上可能不存在 - 如果不存在,则将php.ini-development(或类似)复制到所需的位置。

This is near the top of (a very long) output, so you may find redirecting it to a file helpful ( php -i > C:\\phpinfo.txt ). 这是(很长)输出的顶部,因此您可能会发现将其重定向到有用的文件( php -i > C:\\phpinfo.txt )。

You will also need to uncomment the extension dir. 您还需要取消注释扩展名dir。 For example, find this line in your php.ini file: 例如,在php.ini文件中找到这一行:

;extension_dir = "ext" ; extension_dir =“ext”

Remove the semi-colon in front and save the file. 删除前面的分号并保存文件。 I am sure this will work. 我相信这会奏效。

Remember to open your php.ini Administrator mode 记得打开php.ini管理员模式

更改php.ini中的任何内容后,您必须重新启动服务器,请确保首先执行此操作。

in WAMPserver edit this files: 在WAMPserver中编辑此文件:

D:\\wamp\\bin\\php\\php5.3.10\\php.ini d:\\ WAMP \\ BIN \\ PHP \\ php5.3.10 \\ php.ini中

or 要么

D:\\wamp\\bin\\php\\php5.4.12\\php.ini (based on version) D:\\ wamp \\ bin \\ php \\ php5.4.12 \\ php.ini(基于版本)

Do not use the php.ini in the WAMP server menu. 不要在WAMP服务器菜单中使用php.ini。 It will not work. 不起作用。 Go to the root of your wamp and as indicated above with D as root. 转到你的wamp的根部,如上所示,D为root。

Make a php.ini (eg from php.ini-production ), open it in an editor as admin (!), remove the commenting semicolon ; 制作一个php.ini (例如来自php.ini-production ),在编辑器中以admin (!)打开它,删除注释分号; in front of extension=php_openssl.dll , set the extension_dir correctly, and save the file. extension=php_openssl.dll前面,正确设置extension_dir ,然后保存文件。 After that it should be working. 之后它应该工作。 But once again: open and edit the php.ini as admin. 但是再次:打开并编辑php.ini作为管理员。

If you are using MAMP on Windows, you need to change the extension for php.ini-development to php.ini Then, paste this line ;extension_dir = "ext" into the php.ini file, before the first extension appear, and uncomment this other line ;extension=php_openssl.dll removing the prefixed semicolon. 如果您在Windows上使用MAMP,则需要将php.ini-development的扩展名更改为php.ini然后,在第一个扩展名出现之前,将此行;extension_dir = "ext"粘贴到php.ini文件中,并取消注释这另一行;extension=php_openssl.dll删除前缀分号。 Dont't forget to restart apache 别忘了重启apache

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

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