vincej's avatar
Level 15

How the heck do you install php extensions onto Windows.

I'm taking a windows laptop on holiday and I want to take my work with me. Yes, I am stupid.

There are a whole bunch of extensions you have to add to php.ini as given in the install instructions eg Mbstring, Jso, ctype etc etc.

I have Googled all the responses. No, the extension is not commented out in the php.ini file. No, just putting extension=MBstring just gives a "can not find" error when updating composer. Same deal, if you put, extension=php_Mbstring.dll

I have Googled "Windows install php extension" and you get no more info than what I just presented here.

So, what is the secret to getting these little buggers installed on windows? Many thanks !

0 likes
11 replies
siangboon's avatar

you just need to extract or download the .dll file (https://windows.php.net/download/) and put into your extension folder (you can find yours in php.ini (extension_dir = "ext") and uncomment and save it, then restart your web services. That's it.

vincej's avatar
Level 15

That's brilliant - thank you. Does the .dll file have everything L5.8 specifies in the installation page?

vincej's avatar
Level 15

I had a look at the page you offered. It has all kinds of downloads for PHP, but no where do I see where to find the extensions. Bummer.

jlrdw's avatar

@VINCEJ - Those extensions are usually there already just have to uncomment them in the ini file.

I use Windows and I've never had to add any extensions just uncomment.

vincej's avatar
Level 15

Bizaar ... I'll look again, but all the ones mentioned in the 5.8 install page, I can not find.

BCMath PHP Extension
Ctype PHP Extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension

By the way, do you use Homestead for Windows, or just a downloaded LAMP server, like Xampp. Homestead looked complicated so I just used Xampp.

MarkLL's avatar

@VINCEJ - What @jlrdw said. 99.99% of the time you will find all you need in one of the zip files.

If using nginx or fastcgi/php-FPM, grab VC15 x64 Non Thread Safe If using Apache and mod_php grab VC15 x64 Thread Safe

Extract to folder, then just copy php.ini-development to php.iniand modify to suit.

jlrdw's avatar

@VINCEJ - In the php.ini file like:

;extension=bz2
extension=curl
extension=fileinfo
extension=gd2
;extension=gettext
;extension=gmp
extension=intl
extension=imap
;extension=interbase
;extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it
////  many more

Just remove the semicolon from the extensions you need, some come commented out.

I have used laravel since 4.2, and apache, php, mysql in Windows. I have never had to install an extension, they are there already.

JSON PHP Extension

I work with json all the time, and never needed to install an extension.

MarkLL's avatar

@VINCEJ - If you run php -i in the php install it will show what is included. Some of the basics are "builtin" and don't requre an extension to work. e.g

Configuration

bcmath

BCMath support => enabled
...
ctype

ctype functions => enabled
MaverickChan's avatar

@VINCEJ - in PHP 7.2 or above , you don't have to change extension setup in php.ini.

most extension Laravel need is already there.

check phpinfo();

jlrdw's avatar

Agree with @markll plus Xampp is going to have all necessary extensions, just un comment some. Here is a list of all mine:

;
;extension=bz2
extension=curl
extension=fileinfo
extension=gd2
;extension=gettext
;extension=gmp
extension=intl
extension=imap
;extension=interbase
;extension=ldap
extension=mbstring
extension=exif      ; Must be after mbstring as it depends on it

extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird

extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=shmop

; The MIBS data available in the PHP distribution must be installed.
; See http://www.php.net/manual/en/snmp.installation.php
;extension=snmp

;extension=soap
;extension=sockets
;extension=sodium
;extension=sqlite3
;extension=tidy
extension=xmlrpc
;extension=xsl

With those uncommented, my laravel 5.8 works just fine.

1 like
vincej's avatar
Level 15

Thanks guys! I'm flying all day tomorrow and Sat, so won't get a chance to look at it, but will give you an update maybe Sunday. One advantage of being Canadian is we get to go and enjoy the beaches in Cuba ! :o) Cheers.

Please or to participate in this conversation.