I need to encrypt passwords and some other data in my PHP(5.5.9) application on Ubuntu (14.04) server. I read about libsodium and found it a good fit for the applications requirements. I followed all the instructions given in the only tutorial available for libsoidum.
sudo add-apt-repository ppa:chris-lea/libsodium - Done, no errors
sudo apt-get update && sudo apt-get install libsodium-dev - Done, no errors
pecl install libsodium - Done, no errors
added extension=libsodium.so to php.ini and restarted apache.
When I check phpinfo() page I am able to see the entry for libsodium as follows:
libsodium support enabled
libsodium compiled version 1.0.6
libsodium headers version 1.0.3
libsodium library version 1.0.3
However, when I try to run the basic example given in the above tutorial which is:
<?php var_dump([ \Sodium\library_version_major(),\\Sodium\library_version_minor(),\Sodium\version_string() ]);?>
I get an error saying "Call to undefined function Sodium\library_version_major()".
This is really baffling me as the extension is identified correctly by phpinfo() page.
Can anyone please help me in understanding if I am missing something or doing wrong that I am not able to use libsodium with php. Any help is greatly appreciated.
Thank you.
I assume that you've tried to run the basic example from the command line. In this case it is necessary to not only add extension=libsodium.so to the php.ini of apache2 that is found at /etc/php5/apache2/php.ini on Ubuntu 14.04.
Additional it is necessary to add this line to the php.ini file for the cli environment found at /etc/php5/cli/php.ini.
Related
I've been trying to install Magento 2. I did load everything and with the last commands "composer update" or "composer install" I'm having problem.
Problem 1
- The requested PHP extension ext-mcrypt * is missing from your system.
Problem 2
- The requested PHP extension ext-intl * is missing from your system.
The thing is I'm not a pro Mac user or anything so it's very complicated for me to understand what I need to do to resolve this.
I saw a topic here at stackoverflow with the same problem but in that case they were using MAMP. I'm using XAMPP. They were telling to override PHP with MAMP's PHP with the .bash_profile file. I tried the same - didn't quite understand what I was doing.
So please, can anyone help me with solving ext-mcrypt and ext-intl stuff? I don't even know how to find out if they are missin or not.
Thanks!
Here's what in place of mcrypt
[mcrypt]
; For more information about mcrypt settings see http://php.net/mcrypt-module-open
; Directory where to load mcrypt algorithms
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.algorithms_dir=
; Directory where to load mcrypt modes
; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
;mcrypt.modes_dir=
FINAL NOTES:
I marked answer as correct as it resolved my issue with mcrypt with the link from Laravel requires the Mcrypt PHP extension next I had issue with ext-intl and to resolve this please follow these links: http://codingexplained.com/operating-systems/mac/installing-php-intl-extension-os-x-mavericks and Php-intl installation on XAMPP
I did write an article about these issues and solution. hopefully this helps too!
Have a look at this answer Laravel requires the Mcrypt PHP extension and the following one.
If mcrypt is not enabled open your php.ini (see my first answer link above how to find it) and search for
;extension=php_mcrypt.so
then remove the ; from the beginning of that line. Same procedure for the other extension.
On linux I:
sudo apt-get install php7.0-mcrypt ;
sudo apt-get install php7.0-intl
Following things you can check -
Apache Version: 2.2 or 2.4 and Enable: mod_rewrite.mod_rewrite enables the server to perform URL rewriting.
PHP: 5.4.x where x = 11 or later 5.5.x and
Enable PHP Extension: PDO/MySQL,mbstring, mcrypt, mhash, simplexml, curl, gd2, ImageMagick 6.3.7 (or later) or both soap and
add xdebug.max_nesting_level=50000; at php.ini
MySQL Version : 5.6.x and upper
For more info please have a look at this URL -
http://magentostriker.blogspot.in/2015/03/magento-2-installation.html
Hope it will help.
If you are using Linux and PHP 7.0 you would use something like this:
yum install php70u-intl
I have PHP version 70u in the above example. Bu this will provide "ext-intl".
I changed my default apache server setup on my mac to be able of easily switching between php versions following this guide.
Now, when I return to my project which is based on the CMS TYPO3, I get the error, that "The PHP extension "apcu" must be installed and loaded in order to use the APCu backend.".
So I was following the tutorial (by the same author) to install and enable apcu.
I can sum up the installation process:
$ sphp 5.6
$ brew install autoconf
$ pecl channel-update pecl.php.net
$ pecl install apcu-4.0.11
This actually worked perfectly for php 5.6! But I wanted php 7.2 for my project. The tutorial instructs to do this:
$ sphp 7.2
$ pecl uninstall -r apcu
$ pecl install apcu
No errors here. But the CMS still claims no apcu! Searching for "apc" in phpinfo also returns in no results! Pecl added the extension="apcu.so" line in the loaded php 7.2 ini, so I don't understand what's wrong. Of course I restarted apache every time. Also no errors or warnings here.
Also after googling I have no idea what to do :/
You may try using an absolute path of the apcu.so in php.ini,
Like
extension="/usr/local/Cellar/php/7.3.2/pecl/20180731/apcu.so"
The path depends. Don't know why but this works for me anyway.
You may also need to check the following ini config entry for apcu:
apc.enabled=on
apc.enable_cli=on
Debian : 7.4
I have some difficulty to make ssh2 work with php5. i didn't find a solution on other topics and i search a LOT ! all has been well installed according to debian outputs but it still doesn't work.
This is what i'v done
Package installed :
- php5
- php5-dev
- libssh2-php
- libssh2-1-dev
I used PECL to install
pecl install -f ssh2
I just press enter for auto prefix.
And extension=ssh2.so to /etc/php5/apache2/php.ini
Restart more than one time apache2.
But the package ssh2 still not appear in output of php -m and says that ssh2_connect is undefined
I totally out of resources to make it works, so please can anybody helps me ?
Here some info provided by phpinfo() :
extension_dir /usr/local/lib/php/extensions/no-debug-non-zts-20100525/
extension version 0.12
libssh2 version 1.4.3
banner SSH-2.0-libssh2_1.4.3
If you need i can give more informations
I use phpseclib's libssh2-compatibility-layer to avoid having to install libssh2. You can use all the libssh2 functions without having it installed thanks to the use of phpseclib.
If you're writing your application from scratch maybe try just using phpseclib from the onset intsead of libssh2.
Is there a more up-to-date version of wso2's wsf framework for PHP? The latest version on GitHub doesn't seem to have an installation script, and the tutorials I've found for newer versions don't seem to work at all, despite seeming to have found the latest version (2.1.0?).
Even after finding the ./configure script it still won't make and install on our server (Ubuntu 14.04)
I was running into the same issue. I downloaded an alternate tar.gz of the source code from here:
http://dist.wso2.org/products/wsf/php/2.1.0/wso2-wsf-php-src-2.1.0.tar.gz
This does have the configure file (although I am getting compilation errors afterwards, but your environment might be different).
for those that might be interested, i have begun a rewrite of this extension using php-cpp allowing to support php >= 5.6, this is a work in progress developpment.
project here
I managed to install it successfully on Ubuntu 15.04
You have to install some required packages
apt-get install libapache2-mod-php5 libxml2 libxml2-dev php5-xsl php5-dev php5-config librampart-dev
then you have to download the source from http://dist.wso2.org/products/wsf/php/2.1.0/wso2-wsf-php-src-2.1.0.tar.gz, configure it with gcc 4.4
sudo apt-get install gcc-4.4
./configure CC=gcc-4.4
and then you can make and make install.
If you run into compiling errors check this guide https://jackson-brain.com/compiling-wso2-web-services-framework-for-php-5-5/
I have centos 6.5 server and when I try to install php extension using pecl I get the following error:
XML Extension not found
All the documentations say that this extension is included by default... Why this error still exists?
According to a comment on php.net
Certain Linux distributions do not have this extension included in the minimum PHP package. It can usually be found in one of the "optional" php-* packages.
For CentOS, you will need to run yum install php-xml, which provides this extension.
So please try to install it using:
yum install php-xml
Also check your php.ini and make sure that the extension is not commented out with a ; it should be listed as:
extension=dom.so
In order to be absolutely sure whether or not a module is enabled you should use phpinfo()
Ubuntu 20.04 and phpV7.4 perfectly work. Try this one
sudo apt-get install php-xml