The mbstring extension is missing - php

I'm new to linux. Installed apache2, mysql-server, php 7.0 and phpmyadmin on my Linux Mint 18.1.
Installation went fine, but localhost/phpmyadmin gives error (see title).
Tried:
uncommenting "extension_dir" in php.ini
uncommenting mbstring.dll extension in php.ini
making link from /var/www/html/phpmyadmin to /usr/share/phpmyadmin
reinstalling php7.0-mbstring
but neither worked.
I've been restarting Apache as well.

If you have Apache and PHP running correctly, you should install the mbstring extension on PHP and restart Apache:
sudo apt-get install php7.0-mbstring
sudo service httpd restart
Restarting Apache is a step that most people forget about. Some distributions will restart Apache by themselves when you install any PHP extension, other don't.

Related

Can't make php-CURL run on Centos server using php 7.2.5

I have CentOS server version 7.7 with nginx and PHP 7.2.5 installed
I have installed curl with
sudo yum install curl
and I got this
Package curl-7.29.0-54.el7.x86_64 already installed and latest version
I have installed php curl using
sudo yum install php-curl
Package php-common-7.2.24-1.el7.remi.x86_64 already installed
I restart nginx server using
sudo systemctl restart nginx.service
but still I can't see curl running on server, any ideas?
Please try this code:
sudo yum install php7.2-curl
It is possible, you have few php version installed on your server, and you try to install php-curl (for example to php5.6). It this case you don't use this version.
Also you need restart php-fpm, because nginx restarting doesn't restart php-fpm
sudo systemctl restart php-fpm
I found the problem, I have 2 versions one compiled and another one installed on the system
I have downloaded an updated version of PHP and compile it with curl support to replace the current one.

Error Installing Cake PHP [duplicate]

Using the CakePHP docs, I am trying to install 3.0-beta2 using composer but I got this error:
cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system
However, I know for sure that intl is installed (it shows on phpinfo). I'm using PHP 5.4.33/Apache 2.4.10.1
I faced the same problem today. You need to enable the intl PHP extension in your PHP configuration (.ini).
Solution Xampp (Windows)
Open /xampp/php/php.ini
Change ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon)
Copy all the /xampp/php/ic*.dll files to /xampp/apache/bin
Restart apache in the Xampp control panel
Solution Linux (thanks to Annamalai Somasundaram)
Install the php5-intl extension sudo apt-get install php5-intl
1.1. Alternatively use sudo yum install php5-intl if you are on CentOS or Fedora.
Restart apache sudo service apache2 restart
Solution Mac/OSX (homebrew) (thanks to deizel)
Install the php5-intl extension brew install php56-intl
If you get No available formula for php56-intl follow these instructions.
Restart apache sudo apachectl restart
Eventually you can run composer install to check if it's working. It will give an error if it's not.
I faced the same issue in ubuntu 12.04
Installed: sudo apt-get install php5-intl
Restarted the Apache: sudo service apache2 restart
OS X Homebrew (May 2015):
The intl extension has been removed from the main php5x formulas, so you no longer compile with the --enable-intl flag.
If you can't find the new package:
$ brew install php56-intl
Error: No available formula for php56-intl
Follow these instructions: https://github.com/Homebrew/homebrew-php/issues/1701
$ brew install php56-intl
==> Installing php56-intl from homebrew/homebrew-php
When using MAMP
1 Go to terminal
vim ~/.bash_profile
i
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH
Change php5.6.2 to the php version you use with MAMP
Hit ESC,
Type :wq,
hit Enter
source ~/.bash_profile
which php
2 Install Mac Ports
https://www.macports.org/install.php
sudo port install php5-intl OR sudo port install php53-intl
cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/intl.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/
{take a good look at the folder names that u use the right ones}
3 Add extension
Now, add the extension to your php.ini file:
extension=intl.so
Usefull Link:
https://gist.github.com/irazasyed/5987693
The error message clearly states what the problem is. You need the intl extension installed.
Step 1: install PHP intl you comfortable version
$sudo apt-get install php-intl
step 2:
For XAMPP Server intl extension is already installed, you need to enable this extension to uncomment below the line in your php.ini file. Php.ini file is located at c:\xampp\php\php.ini or where you have installed XAMPP.
Before uncomment:
;extension=php_intl.dll ;extension=php_mbstring.dll
After uncommenting:
extension=php_intl.dll extension=php_mbstring.dll
Short answer: activate intl extension in php_cli.ini. Thanks to #ndm for his input.
If you are using latest version Ubuntu 16.04 or later just do
sudo apt-get install php-intl
Then restart your apache
sudo service apache2 restart
In my case I was not actually trying to run cakephp locally, I was just trying to get it to auto update locally using composer (because I am playing with writing plugins that you install with composer). Since I don't actually even run it locally I could simply ignore requirements by adding the --ignore-platform-reqs flag.
php composer.phar update --ignore-platform-reqs
In my case, my running php version is 7.1.x on mac OSX .
I installed intl command using brew install php71-intl.
Placing extension=intl.so inside php.ini was no effect at all. Finally i looked for extension installed directory and there i saw intl.so and placed that path (extension=/usr/local/Cellar/php71-intl/7.1.11_20/intl.so) to my php.ini file and it solved my problem.
In my case (xampp PHP 8.0)
Find ;extension=intl in /xampp/php/php.ini
Remove ; and Restart Apache
MAKE this
In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
In WAMP, the intl extension is “activated” by default but not working. To make it work you have to go to php folder (by default) C:\wamp\bin\php\php{version}, copy all the files that looks like icu*.dll and paste them into the apache bin directory C:\wamp\bin\apache\apache{version}\bin. Then restart all services and it should be OK.
if you use XAMPP do this
1. turn off XAMPP
2. Modifed the php.ini is located in c/:xampp/php/php.ini
3. intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
For Ubuntu terminal:
Please follow the steps:
Step-1:
cd ~
Step -2: Run the following commands
sudo apt-get install php5-intl
Step -3: You then need to restart Apache
sudo service apache2 restart
For Windows(XAMPP) :
Find the Php.ini file:
/xampp/php/php.ini
Update the php.ini file with remove (;) semi colon like mentioned below:
;extension=php_intl.dll to extension=php_intl.dll
and save the php.ini file.
After that you need to
Restart the xampp using xampp control.
Intl Means :Internationalization extension which enables programmers to perform UCA-conformant collation and number,currency,date,time formatting in PHP scripts.
To enable PHP Intl with PECL can be used.
pecl install intl
On a plain RHEL/CentOS/Fedora, PHP Intl can be install using yum
yum install php-intl
On Ubuntu, PHP Intl can be install using apt-get
apt-get install php5-intl
Restart Apache service for the changes to take effect.
That's it
For those who get Package not found error try sudo apt-get install php7-intl then run composer install in your project directory.
I had the same problem in windows
The error was that I had installed several versions of PHP and the Environment Variables were routing to wrong Path of php see image example
I'm using Mac OS High Sierra and none of these worked for me. But after searching a lot I found one that worked!
This may seem trivial, but in fact about 2 months ago some clever guys made changes in brew repository, so doing just: brew install php71-intl will show you error with message that such recipe doesn’t exists.
Fortunately, there is. There is temporary fix in another brew repo, so all you have to do is:
brew tap kyslik/homebrew-php
brew install kyslik/php/php71-intl
SOURCE: http://blastar.biz/2018/04/14/how-to-enable-php-intl-extension-for-php-7-1-using-xampp-on-macos-high-sierra/
I use Linux Ubuntu 20, you can try this:
Check php installed modules:
php -m | grep intl
If there are no result(s) from this command, you should just go ahead and install the module:
sudo apt-get install php7.4-intl
you will need to change *php7.4 to your desired php version.
you should restart apache when you're done:
sudo service apache2 restart

mbstring extension installed but not working

I am using Linux Mint and apache2 with php5.6.
After installing everything it shows me that mbstring is required. After doing sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
it shows me that I have the newest version already.
I also changed ;extension=php_mbstring.dll to extension=php_mbstring.dll in /etc/php/5.6/apache2/php.ini
I did sudo service apache2 restart
Could anyone help me on this please?
EDIT:
php.ini file - http://pastebin.com/1U3UtHXn
You're trying to load a .dll file on Linux. Those are for Windows.
You need to load the equivalent .so file for Linux.
apachectl configtest --verbose should also help you here.
Well, what I actually did was deleting everything: php, php extensions, phpmyadmin, sql, everything and installing once again the most recent versions.

Xdebug with XAMPP in Ubuntu 14.04

System Configuration
Ubuntu 14.04
Xampp v 5.6.3
installed php5-dev after xampp on
sudo /opt/lampp/lampp start
now want to install Xdebug wihin xampp and I tried available 3 method but nothing is working out , please see the whole process.
1)Ubuntu software package
sudo apt-get install php5-xdebug
command exceuted successfully but no such file in .usr/lib/php5/...
uninstalled
2)Tailored Installation Instructions
downloaded xdebug.tar.gz after checking with wizard
ice#cold:~/Downloads/xdebug-2.2.6$ /usr/bin/phpize5
/usr/bin/phpize5 Cannot find config.m4.
Make sure that you run '/usr/bin/phpize5' in the top level source directory of the module
also tried with phpize, /opt/lampp/bin/phpize but not working out
3)PECL Installation
before that let me check with pecl help version
PEAR Version: 1.9.4
PHP Version: 5.5.9-1ubuntu4.5
Zend Engine Version: 2.5.0
Running on: Linux ice-cold 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64
pecl install xdebug
...
...
Build process completed successfully
Installing '/usr/lib/php5/20121212/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.2.6
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=xdebug.so" to php.ini
executed completely
I can see the file
644 /usr/lib/php5/20121212/xdebug.so
added below line in /opt/lampp/etc/php.ini
[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
restart lampp
but still xdebug icon is missing
Please tell me what is wrong
xdebug is located under xampp folder in
/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
on ubuntu 14.04 just search for it in /opt/lampp and copy the full path to it and then open php.ini and replace
;zend_extension=opcache.so
with
zend_extension="/path/xdebug.so"
in my case
zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
edited in /opt/lmapp/etc/php.ini assigned the location of xdebug.so to zend_extension
[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
Replace with
[xdebug]
zend_extension="xdebug.so"
and restart lampp and Xdebug is installed.
AS I was not doing this before because Xdebug Docs itself warn not to do this
Note: You should ignore any prompts to add "extension=xdebug.so" to php.ini — this will cause problems.
[xdebug]
zend_extension="xdebug.so"
Replace with
[xdebug]
zend_extension="20160603/xdebug.so"
I have installed it by:
sudo apt install php-pear
sudo pecl channel-update pecl.php.net
sudo apt install php7.2-dev
sudo pecl install xdebug
Read the last part of the output, follow, and add the corresponding zend_extension=... line to your php.ini file. Restart php-fpm (or Apache if you have it as an Apache module), and you'll have XDebug!
In my case:
open /opt/lampp/etc/php.ini
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib/php/20170718/xdebug.so" to php.ini
sudo /opt/lampp/lampp restart
Just type the command sudo pecl install xdebug
OR
Install it with source code
git clone -b xdebug_2_4 --single-branch https://github.com/xdebug/xdebug/
OR
wget https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0.zip xdebug.zip && unzip xdebug.zip
cd xdebug
sudo chmod +x ./rebuild.sh && ./rebuild.sh
./configure <CONFIG>
make && sudo make install

Fatal error: Call to undefined function mcrypt_encrypt()

NOTE: The libraries MCrypt support depend on have not been updated in years and MCrypt should no longer be considered a viable or secure method of encrypting data. What's more, MCrypt has been deprecated in PHP 5, and removed entirely in PHP 7. If you have any code that runs MCrypt you should refactor it to use a more modern encryption library.
Does anyone know why this error message: (Call to undefined function mcrypt_encrypt() ) displays when I run the following code below?
Am I missing some steps perhaps any setting in PHP I have to do before this code can work?
$key = 'password to (en/de)crypt';
$string = 'string to be encrypted';
$test = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key),
$string, MCRYPT_MODE_CBC, md5(md5($key)));
If you have recently updated to ubuntu 14.04 here is the fix to this problem:
$ sudo mv /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
$ sudo php5enmod mcrypt
$ sudo service apache2 restart
What had worked for me with PHP version 5.2.8, was to open up php.ini and allow the php_mcrypt.dll extension by removing the ;, i.e. changing:
;extension=php_mcrypt.dll to extension=php_mcrypt.dll
For windows
;extension=php_mcrypt.dll to extension=php_mcrypt.dll
then restart your apache server
For Redhat
sudo yum install php55-mcrypt //if php5.5
sudo yum install php-mcrypt //if less than 5.4
sudo service httpd restart //if apache 2.4
sudo /etc/init.d/httpd restart //if apache 2.2 or less
For Ubuntu
sudo apt-get install php5-mcrypt
sudo service apache2 restart //if server not reloaded automatically
Still not working?
sudo php5enmod mcrypt && sudo service apache2 restart
If you are using PHP 7.2 or up:
This function was DEPRECATED in PHP 7.1.0, and REMOVED in PHP 7.2.0.
source: http://php.net/manual/en/function.mcrypt-encrypt.php
So you have to replace the php code and find a solution without mcrypt.
Or, I just found out, you can STILL use mcrypt in PHP 7.2.0, but you have to install it as a PHP Extension Community Library. (https://pecl.php.net/)
On Debian/Ubuntu Linux distros:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev
then:
sudo pecl install mcrypt-1.0.1
Source: https://www.techrepublic.com/article/how-to-install-mcrypt-for-php-7-2/
You don't have the mcrypt library installed.
See http://www.php.net/manual/en/mcrypt.setup.php for more information.
If you are on shared hosting, you can ask your provider to install it.
In OSX you can easily install mcrypt via homebrew
brew install php54-mcrypt --without-homebrew-php
Then add this line to /etc/php.ini.
extension="/usr/local/Cellar/php54-mcrypt/5.4.24/mcrypt.so"
Under Ubuntu I had the problem and solved it with
$ sudo apt-get install php5-mcrypt
$ sudo service apache2 reload
On ubuntu 14.10 :
Install module mcrypt
sudo apt install php5-mcrypt
Enable module mcrypt on apache2
sudo a2enmod mcrypt
Reload module configuration
sudo service apache2 restart
On Linux Mint 17.1 Rebecca - Call to undefined function mcrypt_create_iv...
Solved by adding the following line to the php.ini
extension=mcrypt.so
After that a
service apache2 restart
solved it...
I had the same issue for PHP 7 version of missing mcrypt.
This worked for me.
sudo apt-get update
sudo apt-get install mcrypt php7.0-mcrypt
sudo apt-get upgrade
sudo service apache2 restart (if needed)
Is mcrypt enabled? You can use phpinfo() to see if it is.
One more thing: if you are serving PHP via a web server such as Apache, try restarting the web server. This will "reset" any PHP modules that might be present, activating the new configuration.
Assuming you are using debian linux (I'm using Linux mint 12, problem was on Ubuntu 12.04.1 LTS server I ssh'ed into.)
I suggest taking #dkamins advice and making sure you have mcrypt installed and active on your php5 install. Use "sudo apt-get install php5-mcrypt" to install. My notes below.
Using PHP version PHP Version 5.3.10-1ubuntu3.4, if you open phpinfo() as suggested by #John Conde, which you do by creating test file on web server (e.g. create status page testphp.php with just the contents "" anywhere accessible on the server via browser)
I found no presence of enabled or disabled status on the status page when opened in browser. When I then opened the php.ini file, mentioned by #Anthony Forloney, thinking to uncomment ;extension=php_mcrypt.dll to extension=php_mcrypt.dll
I toggled that back and forth and restarted Apache (I'm running Apache2 and you can restart in my setup with sudo /etc/init.d/apache2 restart or when you are in that directory just sudo restart I believe)
with change and without change but all no go. I took #dkamins advice and went to install the package with "sudo apt-get install php5-mcrypt" and then restarted apache as above. Then my error was gone and my application worked fine.
If you are using php5-fpm do remeber to restart it, after installing mcrypt
service php5-fpm restart
If you using ubuntu 14.04 here is the fix to this problem:
First check php5-mcryp is already installed apt-get install php5-mcrypt
If installed, just run this two command or install and run this two command
$ sudo php5enmod mcrypt
$ sudo service apache2 restart
I hope it will work.
My Environment: Windows 10, Xampp Control Panel v3.2.4, PHP 7.3.2
Step-1: Download a suitable version for your system from here: https://pecl.php.net/package/mcrypt/1.0.3/windows
Step-2: Unzip and copy php_mcrypt.dll file to ../xampp/php/ext/
Step-3: Open ../xampp/php/php.ini file and add a line extension=php_mcrypt.dll
Step-4: Restart apache, DONE!
In Ubuntu 18.04, and for php7.0
$ sudo apt-get install php7.0-mcrypt
$ sudo systemctl reload apache2
for Linux based (Fedora)
yum -y install php-mcrypt
Enable the module by adding: 'extension=mcrypt.so' to PHP.ini. (/etc/php.ini)
systemctl restart httpd.service
Done!
For me it helped to uninstall mcrypt with:
sudo apt-get purge php5-mcrypt
and simply reinstall it:
sudo apt-get install php5-mcrypt
and dont forget to restart apache as described above.
Dont know why and how this was different in my case (using a vm with provisioned php55), but maybe this will help someone else. I also had this problem with some other modules like xcache...
Check and install php5-mcrypt:
sudo apt-get install php5-mcrypt

Categories