libsodium "Call to undefined function" error - php

I have installed libsodium and libsodium-php on ubuntu 16.04 but when I run:
`<?php
var_dump([
\Sodium\library_version_major(),
\Sodium\library_version_minor(),
\Sodium\version_string()
]);`
I get an error saying:
PHP Fatal error: Uncaught Error: Call to undefined function Sodium\library_version_major()
According to phpinfo() Sodium is enabled and the compiled version is 2.0.1 and the library version is 1.0.13. What am I doing wrong?

The PHP API for libsodium has changed in version 2.0.0 of the extension.
Originally, all functions were in a \Sodium\ namespace.
However, following a vote by PHP developers regarding its inclusion in PHP 7.2, it was decided to move everything to the global namespace instead.
So, what used to be \Sodium\library_version_major() is now sodium_library_version_major().

For those who couldnt get the answer working..
thats because it should be:
<?php
var_dump([
SODIUM_LIBRARY_MAJOR_VERSION,
SODIUM_LIBRARY_MINOR_VERSION,
SODIUM_LIBRARY_VERSION
]);

For those who installed Pecl Version of Soidum and Enabled it in php.ini (extension=sodium.so) And Have same error like Call to Undefined ...
After Restarting Apache & nginx and lack of success finally Reboot server get sodium work exteremly.
PHP 7.3 & >7.3 = libsodium 2.1
Hope to be helpful.

Related

Call to undefined function imagewebp()

I am wondering why i get this error. I updated my php from 5.6.22 to 5.6.40 and now i get this error. This was working fine in previous version but suddenly it turns out like this.
Fatal error: Call to undefined function imagewebp()
Also if try var_dump(function_exists('imagewebp')); it gives false now.
This is my current PHP version
This is the GD Module
So what has to be done to re-enable it in my server.
I have a Cent-OS instance in AWS.
The WBMP Support => enabled is not enough)
You have to add --with-vpx-dir= to your configure line or --with-webp-dir for PHP 7.0+
For me
PHP: 8
I simply uncommented the extension gd and the function worked
extension=gd
in my php.ini file

I want To Make mcrypt work on xampp windows with php 7.2 Error: Call to undefined function mcrypt_module_open()

For a testing purpose I want to get rid of this error " Uncaught Error: Call to undefined function mcrypt_module_open() " . I know its deprecated. Tried pasting the .dll file and addind this line in the php.ini (extension=php_mcrypt
extension=libmcrypt) and no use .. Any Help ?
mcrypt is longer used and has now been deprecated since 7.1 and removed in 7.2 as it wasn't being maintained any longer.
You can use functions such as:
OpenSSL Encryption
Libsodium
PHP's inbuilt password hash/verify
Using mcrypt is not suggested, however downgrading your PHP version will allow you to continue using it without any errors.
mcrypt is deprecated in 7.1 and removed in 7.2. Use the built in libsodium functionality

mcrypt installed and enabled but magento checkout throwing undefined function mcrypt_module_open()

I have a Magento 1.9 site installed and all necessary php extensions. The site works, but when I get to checkout/onepage I get the error:
Fatal error: Call to undefined function mcrypt_module_open() in /path/lib/Varien/Crypt/Mcrypt.php on line 63
I understand this typically means that mcrypt is not installed, but looking at the contents of phpinfo(); reveal that it is installed and enabled
portion of phpinfo
I am running on php 5.3.29 using apache on a mac. I used homebrew to install php53 and php53-mcrypt. I am curious to know why the mcrypt_module_open() function cannot be found if I have mcrypt enabled.

MacPorts PHP 5.5 ftp_ssl_connect() not available

I want to use PHP's ftp_ssl_connect() on my Mac, but I'm getting an error message that the function is not available:
PHP Fatal error: Call to undefined function ftp_ssl_connect()
I've installed Apache and PHP through MacPorts. I'm using PHP version 5.5.23. I've added FTP and OpenSSL support by running:
port install php55-ftp php55-openssl
I've already tried restarting Apache. In PHPInfo() it does say my install supports both FTP and OpenSSL, but still I'm getting the error message above when trying to use ftp_ssl_connect().
How can I enable this function on my machine?

OAuth Class not found

I have a fresh Ubuntu 12.04 installation with a basic web server setup including pecl and OAuth; However, when I run a simple index file (as shown below) I am getting a fatal error:
PHP Fatal error: Class 'OAuth' not found in /var/www/index.php on line 2
Here is my file:
<?php
$oAuth = new \OAuth(CONSUMER_KEY, PRIVATE_KEY);
Obviously the consumer/private keys are my actual keys.
Now I have checked phpinfo() and OAuth is definitely in there. I have it set in my php.ini. I have restarted Apache.
When I run pecl list
Installed packages, channel pecl.php.net
Package Version State
oauth 1.2.3
stable pecl_http 1.7.6 stable
extension_loaded('oauth') // returns true
there's no oAuth in php -m either
Any ideas why I am still getting class not found? I hope it's not something dumb I am missing :)
Cheers guys.

Categories