I have installed PHP 7 on windows 10 to my E:
drive so I can try out composer.
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:\php\ext
and not E:\php\ext
.
I looked in php.ini
but couldn't see whre to set the path of the root installation.
Does it always default to C:
? How do I tell it to look in E:
?
So after installation of PHP the best way to identify the extension directory is to open php info file and check for all the settings. In the php info display it will be written where the extension file of the system is stored. It is also known as extension_dir .
extension_dir = <PATH TO EXTENSIONS>: The extension_dir points to the directory where the PHP extensions are stored. The path can be fully qualified (for example, C:\PHP\ext ) or relative (for example, . \ext). Extensions that are specified lower in the Php. ini file are located in the extension_dir.
To compile PHP extensions on Windows, extract the extension's source code folder into the ext folder of your PHP source directory. Then, rebuild the configure script by running buildconf --force and re-compile PHP using the appropriate flags to enable the extension.
For some reason, PHP for Windows is hardwired to look for extensions in C:\php\ext
no matter where you installed it. But there's a simple fix for this.
In your php.ini
, look for the line extension_dir =
. If it's disabled (as a comment), enable it.
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"
Open a Command Prompt and run php -a
to check if PHP complains about missing extensions. If not, you're doing good.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With