简体   繁体   中英

Sodium availability in php 7.2 Azure linux/fastcgi

After some reading and samples I've been trying to use libsodium in an Azure website.

Since I read that sodium would be part of the php core since 7.2 and php site shows

no additional configuration is needed

tried Windows with fastcgi and Linux

phpinfo() shows sodium in both of them yet i cannot use it , as exampled in https://paragonie.com/book/pecl-libsodium/read/08-advanced.md#crypto-aead-aes256gcm because all i get is

Fatal error: Uncaught Error: Call to undefined function sodium_crypto_aead_aes256gcm_is_available()

my phpinfo -> 
PHP Version 7.2.1  
System  Linux 737d7217d54e 4.4.0-119-generic #143-Ubuntu SMP Mon Apr 2 16:08:24 UTC 2018 x86_64  
Server API  Apache 2.0 Handler  
PHP API 20170718  
PHP Extension   20170718  
Zend Extension  320170718  
Zend Extension Build    API320170718,NTS  
PHP Extension Build API20170718,NTS  
....  
Sodium  Frank Denis  
....

thank you all for the help

I had this same problem -- Azure support sent me this fix and it seems to fix libsodium issue in PHP 7.3 (7.2 is likely the same fix) -

You need to create a settings.ini file and the .ini file should include the following:

extension=sodium

And add the PHP_INI_SCAN_DIR app setting in the azure portal to load the .ini files.

Tested in my home pc where i can tick more boxes and found sodium was disabled by default. after enabling it all went well.

About enabling php extensions in Azure found this link which i'll follow for sodium and hopefully all goes well.

https://blogs.msdn.microsoft.com/azureossds/2017/08/21/enable-php-extensions-on-azure-web-app-on-windows/

thank you all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM