PHP在错误的驱动器上寻找ext文件夹

PHP在错误的驱动器上寻找ext文件夹

本文介绍了PHP在错误的驱动器上寻找ext文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的 E: 驱动器上安装了 Windows 10 上的 PHP 7,所以我可以试用 composer.

I have installed PHP 7 on windows 10 to my E: drive so I can try out composer.

当我尝试运行 composer 我收到一个错误,它找不到我启用的扩展,但我可以看到它在 C:phpext 而不是 E:phpext.

When I try to run composer I get an error that it can't find the extensions I enabled but I can see it is looking in C:phpext and not E:phpext.

我查看了 php.ini,但没有看到设置根安装路径的位置.

I looked in php.ini but couldn't see whre to set the path of the root installation.

它总是默认为 C: 吗?如何告诉它查看 E:?

Does it always default to C:? How do I tell it to look in E:?

推荐答案

由于某种原因,PHP for Windows 被固定在 C:phpext 中寻找扩展,无论你安装在哪里.但是有一个简单的解决方法.

For some reason, PHP for Windows is hardwired to look for extensions in C:phpext no matter where you installed it. But there's a simple fix for this.

在您的 php.ini 中,查找 extension_dir = 行.如果它被禁用(作为评论),请启用它.

In your php.ini, look for the line extension_dir =. If it's disabled (as a comment), enable it.

如果此文件夹位于您的 PHP 安装文件夹中,您只需提及扩展所在文件夹的名称.不需要绝对路径.

You only need to mention the name of the folder where the extensions reside if this folder is inside your PHP installation folder. An absolute path is not necessary.

extension_dir = "ext"

打开命令提示符并运行 php -a 以检查 PHP 是否抱怨缺少扩展.如果没有,你做得很好.

Open a Command Prompt and run php -a to check if PHP complains about missing extensions. If not, you're doing good.

这篇关于PHP在错误的驱动器上寻找ext文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 15:36