Howto ubuntu 18.04 install / activate PHP extension ext-mcrypt - php

I am installing a fresh kubuntu system 18.04, which is using by default php7.2
A composer install for my current software project gibves me this error message:
The requested PHP extension ext-mcrypt * is missing from your system.
Install or enable PHP's mcrypt extension.
Other than before there is no php-mcrypt available and other articles like this http://aryo.lecture.ub.ac.id/easy-install-php-mcrypt-extension-on-ubuntu-linux/ don't help since an analog php-mcrypt or php7-mcrypt does not exists.
How can I get a setup, which fulfills my requirement?
sudo apt-get install php7.2-ext-mcrypt
does not find an installation candidate.
Is there a difference between php 7.1 and 7.2?
not surprisingly this also does not do the trick:
$ sudo phpenmod mcrypt
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available

So it looks like mcrypt is deprecated with php7.2
So I will either have to replace it in my software or follow e.g. this howto to circumvent it:
https://serverpilot.io/community/articles/how-to-install-the-php-mcrypt-extension.html

Related

WARNING: Module mcrypt ini file doesn't exist, but is in installed

I run Ubuntu 16.04 and am trying to install mcrypt.
I can see it in my info.php.
I have followed this steps:
1. Install php7.0-mcrypt
sudo apt install php7.0-mcrypt
2.Create symbolic link to php7.0-mcrypt
sudo ln -s /etc/php/7.0/mods-available/mcrypt.ini /etc/php/7.0/mods-available/
3.Enable mcrypt extension
sudo phpenmod mcrypt
And when I enable I get this:
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
WARNING: Module mcrypt ini file doesn't exist under /etc/php/7.2/mods-available
But I don't use 7.2, I use 7.0 and I have the mcrypt ini file in /etc/php/7.0/mods-available.
The warning reports PHP version 7.2, so that's what is apparently running.
Are you sure you are running PHP-7.0? What does php -v returns?
I suspect you have multiple version of PHP installed on the system.
Try to run sudo update-alternatives --config php and choose the version that you want to work on.
That should fix it.

Your version of PHP does NOT have the intl extension loaded [duplicate]

I need to use the extension intl on my mac with XAMPP.
So I have followed this links:
Php-intl installation on XAMPP for Mac Lion 10.8
http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-xampp.html
I restart always my apache server but isn't installed the extension. Because if I launch:
php -m | grep intl #should return 'intl'
return empty
The command that I can't launch without it is for composer and cakephp like this:
composer create-project --prefer-dist -s dev cakephp/app cakephp3
Return me this error:
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
Problem 2
- cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
- cakephp/bake dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
- Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].
So I need to solve the problem of ext-intl with the extension intl.
Can someone help me with this problem?
How can I install this extension?
Thanks
These below steps helped me, Just in case if you are using OSX
Steps from http://www.phpzce.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp
Check which php path is set i.e.
root$: which php
If you are using xampp on your mac it should be
/Applications/XAMPP/xamppfiles/bin/php
but if its
/usr/bin/php
you need to change your OSx php
root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
Install icu4c
root$: brew install icu4c
Install Intl via PECL
root$: sudo pecl update-channels
root$: sudo pecl install intl
You can check if Intl was installed successfully
root$: php -m | grep intl #should return 'intl'
Done
============================
Note:
From extensions list in /Applications/XAMPP/xamppfiles/etc/php.ini file Add / Uncomment extension=intl.so line. And restart Apache. Thanks #pazhyn
Before installing "intl" you have to install Autoconf if you have not installed it. Thanks #Digant
via Homebrew brew install autoconf automake
or
by running below commands
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install
cd ..
rm -r autoconf-*
I had issues with intl when using Moodle, which I fixed by doing the following:
Re-run the XAMPP installer (if you don't have the installer on hand, download it from here) and tick the "XAMPP Developer Files"
Use your terminal and go into XAMPP's binary folder $ cd /Applications/XAMPP/bin
Use PHP's package manager to install intl by running $ sudo ./pecl install intl This should compile some things, and if successful, the installation should complete with:
Build process completed successfully
Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so'
install ok: channel://pecl.php.net/intl-3.0.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=intl.so" to php.ini
$ cd ../etc There you will have your php.ini to which you have to add extension=intl.so On my system I appended the line after line 959, which you can find by searching for php_intl
Finally restart your Apache web server from the XAMPP GUI.
Hope this works for you!
I had the same problem with XAMPP.
I tried several answers but without success.
Could solve lowering an alternative library http://php-osx.liip.ch/.
This library php, comes already installed intl and several other package.
After downloading went to httpd.conf in xampp and LoadModule php5_module pointed to these packages in /usr/local/php5/libphp5.so

Installation of Magento 2 error: php ext-gd is required

I am trying to install magento/product-community-edition 2.1.3 in cloud9 (Ubuntu 14.04.3 LTS) with PHP 7.0.15
I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for magento/product-community-edition 2.1.3 -> satisfiable by magento/product-community-edition[2.1.3].
- magento/product-community-edition 2.1.3 requires ext-gd * -> the requested PHP extension gd is missing from your system.
To enable extensions, verify that they are enabled in those .ini files:
- /home/ubuntu/.phpbrew/php/php-7.0.15/etc/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
I tried to do the following installation on install php70-gd on ubuntu but I still get the same error afterwards.
How will I successfully install magento 2?
Use following command to install the gd extension:
sudo apt-get install php5.6-gd
it will work for PHP version 5.6
If you are using any other verison of PHP, replace 5.6 by that like:
sudo apt-get install php7.0-gd
for PHP 7.0
run
sudo apt-get install php5.6-gd
or
sudo apt-get install phpX.X-gd
then check your .ini files:
To enable extensions, verify that they are enabled in your .ini
files:
- /etc/php/7.0/cli/php.ini
change
;extension=...
to extension=... for each dependency you need.
If the error is still there, check the PHP version on your localhost/server and the PHP version that you are using with your Magento.
Be aware that all versions of PHP are not compatible to Magento.
More informations: http://devdocs.magento.com/guides/v2.0/comp-mgr/trouble/cman/php-version.html
Good luck!
PS: If you got the same issue for ext-mcrypt, ext-dom or anything else, you will have to follow the same process and then re-run the composer installation.
sudo apt-get install php7.0-dom
sudo apt-get install php7.0-mcrypt
sudo apt-get install php7.0-curl

install GNU PG (GPG) for php5.6 on ubuntu 16.04

I have 2 versions of php installed on my ubuntu php5.6 and php7. 5.6 is set as active version. Now I am trying to install GPG using below line of code, and it installs it under /etc/php/7.0 directory.
sudo apt-get install php-gnupg
How to install it for php5.6?
Extension dir for php 5.6 is /usr/lib/php/20131226 and extension dir for php 7.0 is /usr/lib/php/20151012 as this command shows:
php -r "print phpinfo();" | grep "extension_dir"
Pecl installs gnupg in /usr/lib/php/20131226/gnupg.so because the pecl was installed when php 5.6 is enabled
pecl list-files gnupg
Conclusion: PHP 7.0 uses a different extension directory than where the gnupg is installed.
First try which didn't work: Create symlink for gnup.so inside the php 7.0 extension directory that points to gnup.so inside php 5.6
sudo ln -s /usr/lib/php/20131226/gnupg.so /usr/lib/php/20151012/gnupg.so
Results in:
Warning: PHP Startup: gnupg: Unable to initialize module
Module compiled with module API=20131226
PHP compiled with module API=20151012
Second try which also didn't work:
Uninstall pecl extension: sudo pecl uninstall gnupg
Activate php v 7.0
Install gnupg again: sudo pecl install gnupg
Gives same compiling error.
Final solution:
Install a compiled version of the gnupg that works with php 7.0: see php docs here
Check if gnupg is installed
php -r 'var_dump(function_exists("gnupg_decrypt"));';

Call to undefined function mb_strlen() on PHP 7 Ubuntu 14.04

I had a Yii installation that was working fine up until today. I installed updates on my machine today after which this error was being thrown on all pages:
PHP Fatal Error – yii\base\ErrorException
Uncaught Error: Call to undefined function yii\web\mb_strlen() in /application/vendor/yiisoft/yii2/web/ErrorHandler.php:404
I ran composer update but the error persists.
I am using yii 2.0.7 on PHP 7 on Ubuntu 14.04. How do I fix this?
The error is a bit of a red herring since mb_strlen() is actually part of the mbstring php extension and not a function in yii2.
In php5 mbstring was part of libapache2-mod-php5.
It seems to be missing from libapache2-mod-php7. To fix this install the php7.x-mbstring package where x is your version:
sudo apt install php7.x-mbstring
You may need to restart Apache after this install.
For PHP7.1
Debian flavours
sudo apt-get install php7.1-mbstring
RedHat flavours
sudo yum install php7.1-mbstring
CentOS/RHEL-based
To get a list of available modules to check the version you need is available:
yum search mbstring
Installing mbstring module:
sudo yum install php-mbstring
This will install the correct version for you for your current php installation.

Categories