How to enable 'openssl' in UwAmp CLI?

2019-05-29 02:39发布

i have UwAmp installed. and i'm using php cli command with composer, it says 'you must enable openssl extension'.

i'm sure i was enabled openssl in all php ini every version i have.

how to enable openssl for uwamp cli?

3条回答
forever°为你锁心
2楼-- · 2019-05-29 03:39

If you use UwAmp, the installer Composer will struggle to find the php.ini file, even if you add the PHP folder to your PATH, because it just does not exist! The installer will display an error in the activation of the OpenSSL extension of PHP.

To resolve this issue, go to the folder of the PHP version used by UwAmp. Then copy the php_initial.ini file in the same folder and rename it to php.ini.

Then check the new php.ini the extension_dir variable is set to "ext", so you can install Composer normally.

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; On windows:
extension_dir = "ext"

original source for solution (in french): http://baudet.me/2014/10/installer-et-utiliser-composer-avec-uwamp/

查看更多
孤傲高冷的网名
3楼-- · 2019-05-29 03:41

While asking this question I already found the answer:

  1. Make sure openssl is enabled using the GUI
  2. Find uwamp-directory/php/php-x.x.x/php_uwamp.ini
  3. Copy it to php.ini in the same directory

Done.

查看更多
爱情/是我丢掉的垃圾
4楼-- · 2019-05-29 03:42

I had the same problem using UwAmp whilst trying to install composer, but found that I needed to add one more step before I could get it to work on my system.

After you identify the php_uwamp.ini file and copy it to the same directory as php.ini (as suggested) you need to find the following line

extension_dir = "{PHPEXTPATH}"

and change it to

extension_dir = "./ext"

The {PHPEXTPATH} variable is not interpreted when php is run under the CLI, and composer will complain about missing modules if you don't do this.

查看更多
登录 后发表回答