The json extension is missing. Please check your PHP configuration - php

I install PHP5.6.0 on Ubuntu 13.10 x64 from this
https://launchpad.net/~ondrej/+archive/php5-5.6a
then I installed phpmyadmin when I am trying to lunch phpmyadmin I got this message
The json extension is missing. Please check your PHP configuration.
my PHP modules:
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
libxml
mbstring
mcrypt
mhash
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
then when i use this command to install php-json
sudo apt-get install php5-json
I got this
The following packages have unmet dependencies:
php5-json : Depends: phpapi-20121212
E: Unable to correct problems, you have held broken packages.
How can I fix this problem?

It looks like you are install PHP5 from a custom repo. I would remove PHP and remove that repo.
sudo apt-add-repository --remove ppa:ondrej/php5-5.6
sudo apt-get update
now install php
sudo apt-get install php5-common php5-json

Below solution worked for me-
cd /etc/php5/mods-available
vi json.ini
In this file make below changes
priority=20
extension=json.so
Incase if json.ini file is not there, create the file with contents as
priority=20
extension=json.so

The problem seems to me to be because of Ubuntu's default permissions for the php.ini files. It only allows Root to read/execute the directories holding the in files.
You can easily verify this by observing that when you execute:
sudo php -m
You see all installed and enabled modules listed correctly.
The solution to this I have found on ubuntu distros is to:
sudo chmod a+rx /etc/php5/cli/
sudo chmod a+rx /etc/php5/cli/php.ini
sudo chmod a+rx /etc/php5/cli/conf.d/
Then you can easily verify by running:
php -m

It worked for me after loading the installed modules json and mcrypt.
$ sudo php5enmod json && sudo php5enmod mcrypt $ sudo service apache2 restart
Go to http://yourserver/phpmyadmin and take a look to check if it works.

Related

oci8.so is missing in php modules in Linux Centos 8

I'm having a problem to install oracle instant client in my linux server. Its already 5 days i'm stuck with it. I followed the tutorial but still didn't work.
https://medium.com/#azharnian/cara-install-oci8-php-7-di-centos7-851abbb5d15
https://gist.github.com/Yukibashiri/cebaeaccbe531665a5704b1b34a3498e
https://docs.oracle.com/en/database/oracle/oracle-database/19/lnoci/instant-client.html#GUID-96F664E7-AD1D-4FE4-BCE2-6D9687016A51
I've successfully install apache, php and mariaDB in server. I have no problem running my php and laravel in the server.
But my current problem when I install oracle instant client, i notice that oci8.so in /usr/lib64/php/modules is missing. When I run command pear download pecl/oci8 Error as below.
PHP Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/lib64/php/modules/oci8.so (/usr/lib64/php/modules/oci8.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/oci8.so.so (/usr/lib64/php/modules/oci8.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
intl
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
How can I installed oci8.so in my php modules ? How can I check my OCI status.
Appreciate if someone can help me to solve this issue. Many thanks.
https://linux.uits.uconn.edu/2020/03/06/php-and-oci8-installation-for-rhel8/
This link is a step by step on how to install oci8
dnf install oracle-instantclient18.5-basic-18.5.0.0.0-3.x86_64.rpm oracle-instantclient18.5-devel-18.5.0.0.0-3.x86_64.rpm oracle-instantclient18.5-sqlplus-18.5.0.0.0-3.x86_64.rpm
dnf install libnsl
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Install PHP and OCI8:
dnf module list php
dnf module enable php:remi-7.4 -y
(if you get the following message: “The operation would result in switching of module 'php' stream '7.2' to stream 'remi-7.4’”)
dnf module reset php (enter “y”)
dnf module enable php:remi-7.4 -y
dnf install -y php php-cli php-common php-fpm php-pear gcc curl-devel php-devel zlib-devel pcre-devel php-pecl-http systemtap-sdt-devel
export PHP_DTRACE=yes
setenforce 0
echo "instantclient,/usr/lib/oracle/18.5/client64/lib" | pecl install oci8-2.2.0.tgz
echo extension=oci8.so >> /etc/php.ini
echo extension=oci8 > /etc/php.d/20-oci8.ini
systemctl restart php-fpm
systemctl restart httpd

Using required CURL extension to install Valet

I am trying to install Valet on my laravel 6 project. So when I run composer global require cretueusebiu/valet-windows to install it, I get the following error:
requires ext-curl * -> the requested PHP extension curl is missing from your system.
However, extension=curl is enable in my php.ini file and also I run following command to check whether it is enable or nor:
<?php phpinfo() ?>
There also I can see the curl support is enable. What should I do to use Valet now? I am using Windows 10 and according to this answer, there is curl.exe but it does nothing with my expected answer.
and when I run php -m I get the following:
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
fileinfo
filter
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
Phar
readline
Reflection
session
SimpleXML
sockets
SPL
standard
tidy
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]
So there is no curl available. What do I do to get it?
ext-curl might not be enabled.
Try to enable:
$ sudo phpenmod curl
OR, install:
$ sudo apt install php[7.2,7.3]-curl
Repalce [7.2,7.3] from your installed PHP's version
You can use your OS package manager. Here I've used Aptitude for Debian

How to enable LDAP extension for PHP in Ubuntu

I am trying to enable LDAP for PHP5.6 on Ubuntu 16.04. I have tried the following steps
- sudo apt-get install php5-ldap
- sudo enmod ldap
- sudo php5enmod ldap
but still I am unable to get my ldap related functions working with PHP
you need to restart your apache (systemctl restart apache2). Apache has its very own single php-process running*. The php-configuration is only reload if apache restarts this process. You can check your active configuration with phpinfo
* this is very simplified and depends on the apache MPM-Module you are using.
sudo apt-get install php-ldap
/etc/init.d/apache2 restart
#baig772 answered their own question but they didn't post it as an answer.
latest ubunutu php-ldap was not working I tried installing apt-get install php7.0-ldap which is not working, then I download deb https://debian.pkgs.org/sid/debian-main-amd64/php7.2-ldap_7.2.4-1+b2_amd64.deb.html
wget http://ftp.br.debian.org/debian/pool/main/p/php-defaults/php-common_49_all.deb
wget http://ftp.us.debian.org/debian/pool/main/p/php7.0/php7.0-ldap_7.0.29-1+b2_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/u/ucf/ucf_3.0038_all.deb
then..
apt install ./php7.2-common_7.2.4-1+b2_amd64.deb
apt install ./php7.2-ldap_7.2.4-1+b2_amd64.deb
...
once it is installed confirmed by running the
apt-cache pkgnames | grep ldap | grep php
php-symfony-ldap
php7.2-ldap
php-net-ldap2
php-net-ldap3
check php enabled modules
:/usr/lib/php/7.2# php -m
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
it does not have ldap module..
so copied .so files
:/usr/local/etc/php# cp /usr/lib/php/20170718/ldap.so /usr/local/lib/php/extensions/no-debug-non-zts-20170718/
enable apache ldap " a2enmod ldap"
php-m
now it has ldap module enabled.
[PHP Modules]
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
hash
iconv
json
ldap
libxml
mbstring
restart apache and checked in info.php.
/etc/init.d/apache2 stop
/etc/init.d/apache2 start

Ubuntu pecl install pecl_http fail

I'm trying to install this extension but it fails in the configuration phase. I'm on ubuntu 12.04 and I have just installed these packages:
libcurl3-openssl-dev
php-http
libpcre3-dev
libcurl3
php-pear
php5-dev
PHP version:
PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep 4 2014 07:08:49)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Here is the log of the installation command:
sudo pecl install pecl_http
downloading pecl_http-2.1.1.tgz ...
Starting to download pecl_http-2.1.1.tgz (158,441 bytes)
.................................done: 158,441 bytes
64 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Enable extended HTTP support [yes] :
where to find zlib [/usr] :
where to find libcurl [/usr] :
where to find libevent [/usr] :
building in /tmp/pear/temp/pear-build-rootqE2kgU/pecl_http-2.1.1
running: /tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/home/gare88/Lib/Php/libevent-2.0.21-stable/
checking for grep that handles long lines and -e... /bin/grep
[... cut...]
checking for zlib.h... found in /usr
checking for zlib version >= 1.2.0.4... 1.2.3.4
checking for curl/curl.h... found in /usr
checking for curl-config... found: /usr/bin/curl-config
checking for curl version >= 7.18.2... 7.22.0
checking for SSL support in libcurl... yes
checking for openssl support in libcurl... no
checking for gnutls support in libcurl... no
checking for ares support in libcurl... no
checking for bundled SSL CA info... /etc/ssl/certs/ca-certificates.crt
checking for event2/event.h... not found
configure: WARNING: continuing without libevent support
checking for ext/raphf support... no
configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
ERROR: `/tmp/pear/temp/pecl_http/configure --with-http --with-http-zlib-dir=/usr --with-http-libcurl-dir=/usr --with-http-libevent-dir=/usr' failed
It seems that is a problem with pecl/raphf so I tried:
sudo pecl install raphf
pecl/raphf is already installed and is the same as the released version 1.0.4
install failed
At the end of php.ini file located on /etc/php5/apache2/php.ini
I added the line:
extension=raphf.so
extension=propro.so
extension=http.so
Is there anything else I can try?
You need to install php-raphf from your package manager.
for me i installed the module using the following. In your case you should be able to switch out yum for apt-get.
sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http
The you will need to add extension = http.so to your php.ini file. But it looks like you have already done that.
pecl does not actually install the .so file that you are looking for.
if you have ubuntu 13 or 14, try pecl install pecl_http-1.7.6 as newer versions still do not load for some reason.
On Ubuntu 12.04.5 LTS this worked for me:
First install some prerequisites needed for compilation:
sudo apt-get install php-http
sudo apt-get install php5-dev
sudo apt-get install libcurl3
sudo apt-get install libpcre3-dev
sudo apt-get install libcurl4-openssl-dev
sudo pecl install raphf
sudo pecl install pecl_http-1.7.6
after that go to the folder /usr/lib/php5/modules and check if the libraries are there: raphf.so, propro.so and http.so.
If your php.ini (at /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini) does not contain these extensions, add them:
extension=http.so
extension=propro.so
extension=raphf.so
or using the absolute path to the files, e.g. extension=/usr/lib/php5/modules/http.so.
And as last step restart your webserver, thus loading the new configuration:
sudo service apache2 reload
Just to add to #mschuett's answer, I found that when I got the same error as the OP that changing my extension reference in the php.ini did the trick.
extension=raphf.so
to
extension=/usr/lib/php5/20121212/raphf.so
then
sudo pecl install pecl_http
Also setting the following will keep you from having to hand edit your php.ini file when a pecl installation wants to modify it:
pear config-set php_ini /etc/php5/apache2/php.ini
pecl config-set php_ini /etc/php5/apache2/php.ini
NOTE: This worked for Ubuntu 14.04 LTS.
run command
sudo yum install php-raphf
sudo yum install php-propro
sudo pecl install pecl_http
etc/phph5/apache2/conf.d
add two file
raphf.ini
add content
extension=raphf.so
solr.ini
add content
extension=raphf.so
add in php.ini file
extension=http.so extension=propro.so
extension=raphf.so
or
extension=/usr/lib/php5/20121212/raphf.so
extension=solr.so
I bump into this issue while trying to install pecl_http-2.6.0, raphf-1.1.2 and propro-1.0.2 on Ubuntu 16.04 and php-fpm5.6. I can't use apt to install raphf and propro (as #mschuett suggested) because apt can only install raphf 2.0.0 and propro 2.1.0 which works only for PHP 7.
I resolve the problem with the following steps without needing to update the php.ini nor using apt.
First of all, to get php-fpm to load a new extension, an .ini file must be added to /etc/php/5.6/mods-available. Then use phpenmod to enable the extension.
So to install and enable raphf-1.1.2,
$ pecl install raphf-1.1.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf
Note that you might need sudo for these commands.
Similarly, for propro-1.0.2
$ pecl install raphf-1.0.2
$ echo "extension=raphf.so" >> /etc/php/5.6/mods-available
$ phpenmod raphf
If you use php -m to view all the loaded extensions, you should see raphf and propro in the list.
Now you can install pecl_http-2.6.0 with
$ pecl install pecl_http-2.6.0
The installation should complete successfully.
$ pecl list
Installed packages, channel pecl.php.net:
=========================================
Package Version State
pecl_http 2.6.0 stable
propro 1.0.2 stable
raphf 1.1.2 stable
If you are using pecl like me, you might see warning such as:
install ok: channel://pecl.php.net/pecl_http-2.6.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini
which happens because the php_ini config of my pear and pecl aren't set.

How to enable igbinary with memcached installed first

I have memcached installed with libmemcached. Also I have installed igbinary.
This is my php.ini:
; Directory in which the loadable extensions (modules) reside.
;extension_dir = "./"
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/"
extension=apc.so
apc.enabled=1
apc.shm_size=128M
extension=memcached.so
session.save_handler=memcached
session.save_path="127.0.0.1:11211"
extension=igbinary.so
session.serialize_handler=igbinary
igbinary.compact_strings=On
.
When I run phpinfo() i see that igbinary is enabled, but not for memcached:
apc
Serialization Support php, igbinary
igbinary
igbinary support enabled
igbinary version 1.1.1
igbinary APC serializer ABI 0
Directive Local Value Master Value
igbinary.compact_strings On On
Phpinfo() about memcached:
memcached
memcached support enabled
Version 1.0.2
libmemcached version 0.51
Session support yes
igbinary support no
That last line: igbinary support thats the question. Oddly enough, as you can see under the heading apc there is stated: Serialization Support php, igbinary.
So do someone know why I cannot enable igbinary for memcached?
Thanks!
You can check the Memcached::HAVE_IGBINARY constant to see if your memcached extension was compiled using --enable-memcached-igbinary.
Source: http://php.net/manual/en/memcached.constants.php
Memcached::OPT_SERIALIZER
Specifies the serializer to use for serializing non-scalar values. The
valid serializers are Memcached::SERIALIZER_PHP or
Memcached::SERIALIZER_IGBINARY. The latter is supported only when
memcached is configured with --enable-memcached-igbinary option and
the igbinary extension is loaded.
Type: integer, default: Memcached::SERIALIZER_PHP.
Memcached::HAVE_IGBINARY
Indicates whether igbinary serializer support is available.
Type: boolean.
You can't enable it because PECL memcached was not built with '--enable-memcached-igbinary'
PECL install does not take this as a flag, so here is how you can build pecl memcached with it (following example is on ubuntu as root)
#if you have libmemcached-dev < 1.0.X need to run: sudo apt-get purge libmemcached-dev
apt-get install libevent-dev
pecl install igbinary
#cant do sudo pecl install memcached-2.1.0 cuz it wont let me use igbinary
#compiling manually per http://www.neanderthal-technology.com/2011/11/ubuntu-10-install-php-memcached-with-igbinary-support/
#install libmemcached v 1.0.X for pecl memcached 2.1.0
cd /tmp
libmemcached_ver="1.0.15"
wget https://launchpad.net/libmemcached/1.0/${libmemcached_ver}/+download/libmemcached-${libmemcached_ver}.tar.gz
tar xzvf libmemcached-${libmemcached_ver}.tar.gz
cd libmemcached-${libmemcached_ver}/
./configure
make
make install
cd ../
rm -r libmemcached-${libmemcached_ver}
#install memcached PECL extension
pecl_memcached_ver="2.1.0"
pecl download memcached-${pecl_memcached_ver}
tar xzvf memcached-${pecl_memcached_ver}.tgz
cd memcached-${pecl_memcached_ver}/
phpize
./configure --enable-memcached-igbinary
make
make install
cd ..
rm -r memcached-${pecl_memcached_ver}
echo "extension=igbinary.so" > /etc/php5/fpm/conf.d/igbinary.ini
echo "extension=memcached.so" > /etc/php5/fpm/conf.d/memcached.ini
#now restart your PHP server
Load up a phpinfo() page and you should now see 'igbinary support: yes' under memcached section.
If you work on a Mac and use MacPorts, you can install the php5-memcached extension with igbinary support with this command:
sudo port install php5-memcached +igbinary
The +igbinary specifies a variant of the php5-memcached port.
That command will install an igbinary-enabled memcached extension on your Mac.
You can read more about port variants here: http://guide.macports.org/#using.variants
It's now possible to pass configuration options to pecl install (see the PECL manual)
Here's how you'd install memcached with the igbinary serializer, and all other options left at their default values:
pecl install --configureoptions 'with-libmemcached-dir="no" with-zlib-dir="no" with-system-fastlz="no" enable-memcached-igbinary="yes" enable-memcached-msgpack="no" enable-memcached-json="no" enable-memcached-protocol="no" enable-memcached-sasl="yes" enable-memcached-session="yes"' memcached
The full list of options is defined here (look for the <configureoption> tags): https://github.com/php-memcached-dev/php-memcached/blob/master/package.xml

Categories