Getting error while install Magento 2.x - php

I tried to install Magento 2.x .But it gives an error PHP Extensions Check in PHP Extension intl. I tried to install intl extension by removing the semicolon from php.ini file and then restart the server.But it still gives the same error.
Please tell me ,How to install php_intl PHP Extension on local server?

Please follow below steps to solve the error
For Windows
Stop Wamp/Xampp services
Open Wamp/Xampp php.ini file
Remove semicolon (;) for the line
;extension=php_intl.dll
Restart your services
For Linux
Type command in terminal to install php intl extension
sudo apt-get install php5-intl
Restart php fpm services by writing below command in terminal
sudo service php5-fpm retsart

Related

I got an error "You must enable the intl extension to use CakePHP."

I am using CakePHP 4, apache2.4, PHP8.0 and OS is Debian.
I already uncommented extension=intl in php.ini then I found another intl.ini in different directory and it's also uncommented so I ran sudo systemctl restart apache2 and check then php -vthis error came => Module "intl" is already loaded. So I commented one of them. Then error is gone but I still getting the error "enable intl" one.
I've been struggling this for days.
With Debian it's not enough just to uncomment the line in PHP.INI as you won't have the intl software available.
You need to install the intl package, which will update the PHP.INI files as well.
At the command line enter
sudo apt install php8.0-intl
Then restart Apache
sudo service apache2 restart
And if you're using the FPM module, restart that too
sudo service php8.0-fpm restart

How to install and activate PDO for PHP 7? [duplicate]

I am trying to setup webserver with PHP 7 RC3 + Nginx on Ubuntu 14.04 (for test purposes).
I installed Ubuntu in Vagrant using ubuntu/trusty64 and PHP 7 RC 3 from Ondřej Surý (https://launchpad.net/~ondrej/+archive/ubuntu/php-7.0).
I can not find the way to install MySQL PDO (PHP sees PDO class but not anything related to MySQL, like PDO::MYSQL_ATTR_DIRECT_QUERY etc.)
Looks like there is no lib php7.0-mysql (by analogy with standard php5-mysqlnd and php7.0-fpm etc. from Ondřej)
Section PDO in phpinfo():
PDO support enabled
PDO drivers no value
How can I get it?
For thoses running Linux with apache2 you need to install php-mysql
apt-get install php-mysql
or if you are running ubuntu 16.04 or higher just running the following command will be enought, no need to edit your php.ini file
apt-get install php7.2-mysql
If you are running ubuntu 15.10 or below:
Edit your php.ini file, it's located at /etc/php/[version]/apache2/php.ini and search for pdo_mysql
you might found something like this
;extension=pdo_mysql.so
Change it to this
extension=pdo_mysql.so
Save the file and restart apache
service apache2 restart
Check that it's available in your phpinfo()
First install php-mysql
sudo apt-get install php7.0-mysql
//change the version number based on the php version
then enable the module
sudo phpenmod pdo_mysql
and restart apache
sudo service apache2 restart
On ubuntu 18.04 following works for me
type this in your terminal
For php7.3
sudo apt-get install php7.3-gd php7.3-mysql
For php7.0
sudo apt-get install php7.0-gd php7.0-mysql
For php5
sudo apt-get install php5-gd php5-mysql
First, check if your php.ini has the extension enabled "php_pdo_mysql" and "php_mysqli" and the path of "extension_dir" is correct. If you need one of above configuration, then, you must restart the php-fpm to apply the changes.
In my case (where i am using the Windows OS in the company, i really prefer OSX or Linux), i solved the problem putting this values in the php.ini:
; ...
extension_dir = "ext"
; ...
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
; ...
I hope this helps.
Since eggyal didn't provided his comment as answer after he gave right advice in a comment - i am posting it here: In my case I had to install module php-mysql. See comments under the question for details.
If you are on windows, and your php folder is not in your PATH, you have set the absolute directory in your php.ini
for example:
extension_dir = "C:/php7/ext"
and uncomment
extension=php_mysqli.dll
extension=php_pdo_mysql.dll
Restart apache2.4 and it should work.
I hope it helps.
download the source code of php 7 and extract it.
open your terminal
swim to the ext/mysqli directory
use commands:
phpize
./configure
make
make install (as root)
enable extension=mysqli.so in your php.ini file
done!
This worked for me
I had, pretty much, the same problem. I was able to see that PDO was enabled but I had no available drivers (using PHP 7-RC4). I managed to resolve the issue by adding the php_pdo_mysql extension to those which were enabled.
Hope this helps!
I resolved my problem on ubunto 20.4 by reinstalling php-mysql.
Remove php-mysql:
sudo apt purge php7.2-mysql
Then install php-mysql:
sudo apt install php7.2-mysql
It will add new configurations in php.ini
Had the same issue, resolved by actually enabling the extension in the php.ini with the right file name. It was listed as php_pdo_mysql.so but the module name in /lib/php/modules was called just pdo_mysql.so
So just remove the "php_" prefix from the php.ini file and then restart the httpd service and it worked like a charm.
Please note that I'm using Arch and thus path names and services may be different depending on your distrubution.
I'll start with the answer then context NOTE this fix was logged above, I'm just re-stating it for anyone googling.
Download the source code of php 7 and extract it.
open your terminal
swim to the ext/pdo_mysql directory
use commands:
phpize
./configure
make
make install (as root)
enable extension=mysqli.so in your php.ini file
This is logged as an answer from here (please upvote it if it helped you too): https://stackoverflow.com/a/39277373/3912517
Context:
I'm trying to add LimeSurvey to the standard WordPress Docker. The single point holding me back is "PHP PDO driver library" which is "None found"
php -i | grep PDO
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_odbc' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/pdo_odbc.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
PDO
PDO support => enabled
PDO drivers => sqlite
PDO Driver for SQLite 3.x => enabled
Ubuntu 16 (Ubuntu 7.3.0)
apt-get install php7.0-mysql
Result:
Package 'php7.0-mysql' has no installation candidate
Get instructions saying all I have to do is run this:
add-apt-repository -y ppa:ondrej/apache2
But then I get this:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 223: ordinal not in range(128)
So I try and force some type of UTF:
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/apache2
and I get this:
no valid OpenPGP data found.
Follow some other instructions to run this:
apt-get update
and I get this:
Err:14 http://ppa.launchpad.net/ondrej/apache2/ubuntu cosmic/main amd64 Packages
404 Not Found
Err:15 http://ppa.launchpad.net/ondrej/php/ubuntu cosmic/main amd64 Packages
404 Not Found
and - I think because of that - I then get:
The repository 'http://ppa.launchpad.net/ondrej/apache2/ubuntu cosmic Release' does not have a Release file.
By this stage, I'm still getting this on apt-get update:
Package 'php7.0-mysql' has no installation candidate.
I start trying to add in php libraries, got Unicode issues, tried to get around that and.... you get the idea... whack-a-mole. I gave up and looked to see if I could compile it and I found the answer I started with.
You might be wondering why I wrote so much? So that anyone googling can find this solution (including me!).
['class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost:3306;dbname=testdb',
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',]
It's simple:
Just provide the port number along with the host name
and set default sock path to your mysql.sock file path in php.ini which the server is running on.
Just as an update for those working with installing Linux programs, please note, that things such as 'php7.0-common' are now simply known as 'php-common'.

phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration

I have a problem running phpMyAdmin. When I try to access phpMyAdmin in my browser, I get the error message: "The mbstring extension is missing. Please check your PHP configuration."
I have already searched on the internet for possible solutions. According to that, I made some modifications in php.ini file. I uncommented the line ";extension=php_mbstring.dll" and wrote the full path of the ext folder in extension_dir. Sadly, it still doesn't work.
Could you please help me finding the proper solution.
just run these command
sudo apt-get install phpmyadmin php-mbstring php-gettext
sudo service apache2 restart
Or you can follow this post...
Check This Post
I've solved my problem by this way:
Edit the php.ini file:
change extension_dir = "ext" into extension_dir = "D:\php\ext" (please write ur own path)
change ;extension=php_mbstring.dll into extension=php_mbstring.dll (delete the ";")
Then just save your php.ini file and copy it to ur Windows directory。(“C:\Windows“)
restart the apache server。
The above is my solution,Hope it will work for u.
If you are ubuntu 14.04 and using php 5.6
You are missing out on mbstring and mysql module
Please install mbstring and mysql by
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-mysql
and restart apache
sudo service apache2 restart
It could happen after you update your php version, for instance if you upgrade from php5.6 to php7.1 you need to run these commands:
sudo apt-get install php7.1-mbstring
sudo service apache2 restart
For php8.1
sudo apt-get install php8.1-mbstring
sudo systemctl restart nginx
If your destination version is different you need to check if the mbstring package exsit or not, an example for php7.0:
sudo apt-cache search php7.0-mbstring
I found it useful to first check existence of all modules that you working with, then performing an upgrade, in addition to that update phpmyadmin after upgrading your php is a good idea
In my case i made a new installation of php7 using xampp, the error was in php.ini at line 699, i just did
include_path= C:\Program Files (x86)\xampp\php\PEAR
to
include_path= "C:\Program Files (x86)\xampp\php\PEAR"
and it worked for me.
I checked this by running the php.exe it gave me that error and i fixed it.
Change extension_dir = "ext" to extension_dir = "C:/php/ext" in php.ini.
It could raise the concern if you're either:
Case 1: Downgrading/ upgrading any PHP version.
Case 2: Enabling/Disabling (Switching) between PHP versions.
Here are some recommended commands I found helpful to fix these concerns:
Message 1: The mbstring extension is missing.......
sudo apt-get install php7.1-mbstring
Message 2: The mysqli extension is missing.......
sudo apt-get install php7.1-mysqli
Note: Tested with PHP version 7.1. Change PHP version as per requirement.
I have solved my problem by this way:
Edit the c:\php\php.ini file:
change extension_dir = "ext" into extension_dir = "c:\php\ext" (please write
ur own path)
change ;extension=php_mbstring.dll into extension=php_mbstring.dll (delete
the ";")
restart the apache server。
I Hope it will work for u.
This worked for me on Kali-linux 2018 :
apt-get install php7.0-mbstring
service apache2 restart
You also need to define PHPIniDir - c:/php_install_path
You can try this
sudo apt-get install phpmyadmin php-mbstring php-gettext
sudo ln -s /usr/share/phpmyadmin/ /var/www/html/phpmyadmin
service apache2 restart
this ones solved my problem
1.open command prompt in administration
then open apache bin folder like this,
c:\ cd wamp\bin\apache\apache2.4.17\bin>
then type after the above
c:\ cd wamp\bin\apache\apache2.4.17\bin> mklink php.ini d:\wamp\bin\php\php5.6.15\phpForApache.ini
thats it close the command prompt and restart the wamp and open it in admin mode.
original post : PHP: No php.ini file thanks to xiao.
before you do other way, please do open php.exe on your PHP folder.
run it and if you faced any error statement on it, you can fix it manually.
else, do most-usefull post in this thread.
I see this error after I disabled php5.6 and enabled php7.3 in ubuntu18.0.4
so i reverse it and problem resolved :DDD
This worked for me on Ubuntu with PHP 8:
sudo apt-get install php8.0-mbstring

call to undefined function mb_strimwidth

Months ago I made a short code that uses mb_strimwidth() to exactly fit some text into a table cell, putting dots at the end of a truncated string.
Now, after some times, I tried to execute that same code and it went out with this error:
Fatal error: Call to undefined function mb_strimwidth() in ...
I tried to find the mbstring.php file, and when I found the mb_strimwidth() function, I discovered that it is not implemented anymore. How is that possible?
But my main question is: how can I get the same result as mb_strimwidth()?
I thought to rewrite the function using a loop and mb_strwidth(), but ALL the functions in that mbstring.php file are empty.
All mb_* functions are provided by a PHP extension called Multibyte String, internal name mbstring
You probably don't have the extension active or installed. On most Linux distros you can install the package php-mbstring to install and activate this extension.
Apache needs to be restarted afterwards if you are using mod_php
Just got this issue, if you are using linux just install the package php-mbstringand restart Apache.
sudo apt-get install php-mbstring
sudo service apache2 restart
If you are using specific PHP version, you may need to run the following:
sudo apt-get install php7.x-mbstring
sudo service apache2 restart
Replace 7.x by the exact PHP version.
u need to install php-mbstring package try.
check php version
php -v
then check mbstring already install and enable
php -i | grep mbstring
if not installed run this command
sudo apt-get install php-mbstring
if you are php other version example : 7.1, 7.2, 7.0 based on
run command like this :
sudo apt-get install php7.1-mbstring
if you are using nginx server for run laravel .. then check nginx configration file which version u have loaded in conf file..
go to cd /etc/nginx/sites-available and open your configuration file..
if you are loading php7.2 version in nginx conf file..
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
then u need to install 7.2 mbstring package..
sudo apt-get install php7.2-mbstring
and restart apache2 server
sudo service apache2 restart
if you already installed mbstring then you have to call this extension on php.ini file.
First, detect where is your php-fpm.ini file or php.ini.
run command
php -i | grep php.ini
it returns you path of php.ini file.
for example
/etc/php.ini
then open file with VIM or another editor
vim /etc/php.ini
and then add mbstring extension to php.ini file
extension=mbstring.so;
finally, restart php-fpm
systemctl restart php-fpm

Fatal error: Class 'IntlDateFormatter' not found

I installed WAMP on my local machine. My PHP version is 5.3.3 in phpinfo() but that extension doesn't exist! :(
How can I install this extension without compiling it? Here is just source of it.
The extension was there! All you need to do is clearing the comment(;) before this line in php.ini file:
Windows:
;extension=php_intl.dll
to
extension=php_intl.dll
Linux:
;extension=intl
to
extension=intl
Then restart apache2 or php-fpm if you are using it.
if you see this on Debian / other Linux platforms.
sudo apt-get install php5-intl - for PHP 5.6
sudo apt-get install php7.0-intl - PHP 7+
Amazon Linux
sudo yum install php70-intl
After that restart Apache services.
sudo service apache2 restart restart apache to get the changes.
in wamp or xampp open php.ini file and find the below line, then remove comment (;) at first of it:
;extension=php_intl.dll
if you did not find the line, add it in the php.ini file:
extension=php_intl.dll
It may be because of Apache. Restart Apache by following command
service httpd restart
and try again.
If you added extension=php_intl.dll in your php.ini and it didn't work you can copy icu****.dll files (about five of them) from PHP folder to Apache /bin folder.

Categories