Fatal error : Class 'Imagick' not found Ubuntu 14.04.5 LTS - php

I'm running Ubuntu 14.04.5 LTS
I've run following commands
sudo apt-get update
sudo apt-get install imagemagick
sudo apt-get install php5-imagick
sudo apt-get update
Edited my php.in /etc/php/5.6/apache2/php.ini added following at end of file
extension=imagick.so
After all this
sudo service apache2 restart
But still I'm getting the error and even in php -m it's not showing Imagick.
Using
PHP 5.6.28-2+deb.sury.org~trusty+1 (cli)

Okay finally got solution..
sudo apt-get install php5.6-imagick
sudo service apache2 graceful

Related

Can't reinstall php7.3 on debian

For some reason, my php cli switched to 5.6.40 instead of the 7.2 version that I had before. Then I was unable to restart apache2, so I tried to apt purge php7 & php5 to reinstall them.
But now, I only have this error:
(sorry for the French, it says packages have unsatisfied dependencies). How can I clean it ?
I have already tried the following commands :
apt-get -f install
apt-get clean
apt-get update
apt-get upgrade
You have to purge comlete php7.3:
sudo apt-get remove -y --purge php7.3*
add repository (if not exist):
sudo add-apt-repository ppa:ondrej/php
install dependents
sudo apt install php libapache2-mod-php
if you have apache:
sudo systemctl restart apache2
if you have nginx:
sudo service nginx restart
install php:
sudo apt install php-fpm
check php:
sudo service php7.3-fpm status

How to install memcached with php 7.1 in centOS?

I've tried following commands:
sudo yum -y update
sudo yum install -y libevent libevent-devel
sudo yum install -y memcached
sudo yum install -y php-pecl-memcache
sudo service memcached restart
sudo service httpd restart
I can see only memcache module which is installed after run above commands.
Finally got Solution!
I've done some research on installation any module for php 7.1. I got success while run below command:
sudo yum install -y php71-memcached [use 72 instead of 71(php version) for php7.2]
I think you had tried commands from this link, but all are not working :D
https://devdocs.magento.com/guides/v2.3/config-guide/memcache/memcache_centos.html

How to install PHP intl extension in Ubuntu 14.04

I have a hard time to find exact method to install PHP intl extension in Ubuntu 14.04.
I tried with sudo apt-get install php5-intl but displays error Unable to locate package.
I really need this extension for Zend Framework 2 , because of above missing extension I am getting error like this
ERROR: Zend\I18n\Validator component requires the intl PHP extension
I am using PHP 5.5.9.
How can I install PHP-intl extension in a correct way ?
For php5 on Ubuntu 14.04
sudo apt-get install php5-intl
For php7 on Ubuntu 16.04
sudo apt-get install php7.0-intl
For php7.2 on Ubuntu 18.04
sudo apt-get install php7.2-intl
Anyway restart your apache after
sudo service apache2 restart
IMPORTANT NOTE: Keep in mind that your php in your terminal/command
line has NOTHING todo with the php used by the apache webserver!
If the extension is already installed you should try to enable it. Either in the php.ini file or from command line.
Syntax:
php:
phpenmod [mod name]
apache:
a2enmod [mod name]
install it from terminal
sudo apt-get install php-intl
May be universe repository is disabled, here is your package in it
Enable it
sudo add-apt-repository universe
Update
sudo apt-get update
And install
sudo apt-get install php5-intl
In Ubuntu 20.04, PHP 7.4 use the following command:
sudo apt-get install php7.4-intl
replace 7.4 with your PHP version
So, I have problem with it. If you can't install see below.
And previously you have to add repository.
sudo add-apt-repository ppa:ondrej/php
2.1) sudo apt-add-repository ppa:ondrej/apache2
or
2.2) sudo add-apt-repository ppa:ondrej/nginx
After that you can install
sudo apt-get install php7.4-intl
Where 7.4 your php version.
For php 5.6 on ubuntu 16.04
sudo apt-get install php5.6-intl
sudo apt-get install php-intl
then restart your server
This method works for me to install PHP intl extension in Ubuntu 18.04 and nginx
sudo apt install php7.2-intl -y
you could search with
aptitude search intl
after you can choose the right one, for example
sudo aptitude install php-intl
and finally
sudo service apache2 restart
good Luck!

phpMyAdmin - Error : (The mysqli extension is missing) after upgrading php 5.6 to php 7

I have a problem with phpmyadmin on ubuntu 16.04 after upgrading php 5.6 to php 7 by this way:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
after this command :
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
phpMyadmin has error :
The mysqli extension is missing. Please check your PHP configuration.
But it does not have error on php5.
I want use phpMyadmin on php7.
Can anyone help me?
You need to do following steps.
php --version
Check your php version and run following command.
sudo apt-get install php5.6-mysql
In my case my version of php is 5.6, you may have different. Replace your version and hit enter.
After installing just run
sudo service apache2 restart
Hope it will help
You first need to install php7 , then install php5.
Completely remove your php and phpmyadmin :
sudo dpkg -P phpmyadmin
sudo rm -f /etc/apache2/conf.d/phpmyadmin.conf
sudo service apache2 restart
sudo apt-get purge php.*
sudo service apache2 restart
Install php7 and php7.0-mysql and ... : https://askubuntu.com/a/705893/424146
Install phpmyadmin (on php7) : install phpmyadmin with lamp stack on ubuntu 16.04
Run these commands again to install php5.6 beside your php7:
Install php5.6 beside php7 : (I got help from this link)
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0 php5.6 php5.6-mysql php-gettext php5.6-mbstring php-mbstring php7.0-mbstring php-xdebug libapache2-mod-php5.6 libapache2-mod-php7.0
sudo service apache2 restart
Switch PHP version:
From php5.6 to php7.0 :
sudo a2dismod php5.6 ; sudo a2enmod php7.0 ; sudo service apache2 restart
From php7.0 to php5.6 :
sudo a2dismod php7.0 ; sudo a2enmod php5.6 ; sudo service apache2 restart
Reinstall or Reconfigure PHPMyAdmin. The following worked for me:
dpkg-reconfigure phpmyadmin
Solution for Windows PC
Try to check to check your httpd-xampp config file.
Make sure the Make sure the Php-Module conform with your current php version.
example here: IfModule php5_module
Based on your migration you are using php7, so edit all the php5_module tag in your config file to php7_module and restart the apache server.

php fatal error: class sqlite3 is not found in

Im using ubuntu 12.04, and php 5.x I need to use sqlite3 in it but Im getting an error of
php fatal error: class sqlite3 not found
I done all the installation processes,
like
$ sudo apt-get install php5-cli php5-dev make
$ sudo apt-get install libsqlite3-0 libsqlite3-dev
$ sudo apt-get install php5-sqlite3
$ sudo apt-get remove php5-sqlite3
$ cd ~
$ wget http://pecl.php.net/get/sqlite3-0.6.tgz
$ tar -zxf sqlite3-0.6.tgz
$ cd sqlite3-0.6/
$ sudo phpize
$ sudo ./configure
$ sudo make
$ sudo make install
$ sudo apache2ctl restart
and
cd /etc/php5/conf.d
cat > sqlite3.ini
# configuration for php SQLite3 module
extension=sqlite3.so
^D
sudo /etc/init.d/apache2 restart
now what else I want to do???
Can anyone please help me to fix this...
Thankyou In advance.
Found a solution my self,
I installed
$ sudo apt-get install php5-sqlite
not
$ sudo apt-get install php5-sqlite3
and using sqlite3 class only.. no issue now.
Step 1 :
For PHP5, use
sudo apt-get install php5-sqlite
For PHP7.0, use
sudo apt-get install php7.0-sqlite
For PHP7.1, use
sudo apt-get install php7.1-sqlite
For PHP7.2, use
sudo apt-get install php7.2-sqlite
For PHP7.3, use
sudo apt-get install php7.3-sqlite
Step 2 :
Restart Apache
sudo service apache2 restart
For the error PHP Fatal error: Uncaught Error: Class 'SQLite3' not found in /path/file.php:1 on ArchLinux:
Install the sqlite extension for PHP:
$ sudo pacman -S php-sqlite
Then edit /etc/php/php.ini and add:
extension=pdo_sqlite
extension=sqlite3
Source: 1
I had the same problem even I have installed all libraries.
If you run php-fcgi, you should restart it:
sudo service php-fcgi restart
Try also restart apache:
sudo service apache restart
My PHP is 7.3 so I used the following
For PHP7.3, use
sudo apt install php7.3-sqlite3
And don't forget to restart your Apache2
sudo service apache2 restart
In order to install the missing class sqlite3, please run:
apt-get install php7.4-sqlite3
If you use XAMPP or anything else first close it.
Go to this directory: xampp > php > php.ini (find this file php.ini on PHP folder)
Open php.ini file with notepad
Search "SQLite3"
Remove ";" this line ;extension=sqlite3
Finally be extension=sqlite3
Save file
Open XAMPP
I had the same error. If you are on Windows, don't forget to uncomment php_sqlite3.dll (and optionally php_pdo_sqlite.dll) extension in php.ini. Save php.ini and start the script again.
(I added this answer to the question with the ubuntu tag because this question is on the first place in google for the request php sqlite3 not found).
For php5.6 use:
sudo apt-get install php5.6-sqlite3
run this command in linux system or (based on your operating system and php versoin )
system info - ubuntu 20
php 7.4
server - php local
sudo apt-get install php7.4-sqlite3
then you need to restart the your web server app like apache, nginx, or local php server then try to run
you can run the code test sqlite working
<?php
class MyDB extends SQLite3 {
function __construct() {
$this->open('sqlitedb.db');
}
}
$db = new MyDB();
if(!$db) {
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully\n";
}
?>
create php file index.php
i am using php local server
php -S localhost:8000
(http://localhost:8000) open that url

Categories