How do I allow VS Code to use Local WP's PHP with Open SSL enabled?

Issue Summary

Following the instructions to install Composer, when running php composer-setup.php I receive:

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:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl

My VS Code has PHP located:
"php.validate.executablePath": "C:/Users/Steve/AppData/Local/Programs/Local/resources/extraResources/lightning-services/php-8.1.9+8/bin/win64/php.exe",

& checking C:\Users\Steve\AppData\Local\Programs\Local\resources\extraResources\lightning-services\php-8.1.9+8\conf\php.ini: I see:

extension=php_openssl.dll

is uncommented.

How do I allow VS Code to use Local WP’s PHP with Open SSL enabled?

Replication

In VS Code’s settings.json, set:
"php.validate.executablePath": "C:/Users/[username]/AppData/Local/Programs/Local/resources/extraResources/lightning-services/php-8.1.9+8/bin/win64/php.exe",

Execute the following in VS Code terminal (taken from Composer):

php -r "copy('http://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php

This last command may generate the error:

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:

The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl

System Details

  • Which version of Local is being used? 6.7.2.
    What Operating System (OS) and OS version is being used? Windows 11 64-bit.

I had to:

  1. Copy C:\Users\Steve\AppData\Local\Programs\Local\resources\extraResources\lightning-services\php-8.1.9+8\bin\win64\php.ini-development to C:\Users\Steve\AppData\Local\Programs\Local\resources\extraResources\lightning-services\php-8.1.9+8\bin\win64\php.ini
  2. Uncomment the line extension=php_openssl.dll
  3. Uncomment this line: extension_dir = "ext"
2 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.