PHP Fatal error: Call to undefined function json_decode() in Xampp - php

I'm using Xampp to run a php file using Brackets. I got this error:
PHP Fatal error: Call to undefined function json_decode() in Xampp
I don't know if this is related but I checked the php info file and there are no disabled files. In the json section it says support enabled, json version 1.4.0. In the ini file I searched for json but couldn't find anything.
How can I resolve this error?

if you are on Ubuntu use the following command in command line shell
sudo apt-get install php5-json
if you are on windows, edit php.ini and enable the json extension.

Related

Issues using PHP Trader Functions: Call to undefined function trader_ma()

I'm attempting to install the Trader extension on my mac. I believe the install was done correctly but can't seem to use them. Here is my feedback from terminal
sudo pecl install trader
pecl/trader is already installed and is the same as the released version 0.4.0
install failed
Based on that it shows that I have installed it. But here is what I get when trying to use one
Uncaught Error: Call to undefined function trader_cci()
Anybody have tips on a step I may have missed?
Thanks in advance!
Did you include the extension in your php.ini file? You will need to add the following line in the correct ini (depends on if you use it on the command line or via FPM) to tell PHP that it needs to load the installed extension
extension=trader.so

Call to undefined function simplexml_load_string()

Call to undefined function simplexml_load_string()
I am getting this error on all the sites located on our server. Everything was working correctly until today and all of sudden this error poped up.
I have checked Simplexml and it is already installed on the server. Here is the error:
Fatal error: Call to undefined function simplexml_load_string() in
.../lib/Varien/Simplexml/Config.php on line 510
Had the same problem today. I tried to check whether extension is loaded and I was getting true (from command line) Then I found that I was using multiple php versions and the site in question was using php5.4 which for some reason was failing for simplexml
Since I am in a cPanel/WHM environment I ran
yum install ea-php54-php-simplexml
which fixed the issue. This is for EasyApache4. Perhaps you can just update simplexml sepending on your flavour of linux.
Installing latest extension resolved the issue.
yum install ea-php56-php-simplexml

Uncaught Error: Call to undefined function curl_init()

I have a wordpress plugin that is trying to use curl but giving me the following error.
PHP Fatal error: Uncaught Error: Call to undefined function curl_init()
$curl = curl_init();
I have the same issue on my local dev environment and in my staging environment.
http://topmortgagepro.com/whats-your-home-worth/
At the time of posting it will include the phpinfo() That will be removed if you see this at a later time. htaccess user/password is pixona:pixona to see the site.
I have tried many solutions offered with no luck. Open to ideas and can show other config settings as needed.
I have tried the following and restarted apache after each (on local machine):
apt-get install php-curl
apt-get install php7.0-curl
edited the php.ini to uncomment the following:
extension=php_curl.dll
extension=php_bz2.dll
added this extension in the php.ini
extension=php_curl.so
phpenmod curl
The solution came down to the distribution being out of date. To diagnose the issue I made a sample script to see if curl was loading.
<?php
if (!extension_loaded('curl')) {
echo 'failed';
} else {
echo 'loaded';
}
?>
This gave me the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: undefined symbol: zend_unset_property in Unknown on line 0
With that I came across this other question which suggested doing
apt-get dist-upgrade
PHP Startup: Unable to load dynamic library `curl.so` Ubuntu
After the upgrade (I used the new php.ini) the script worked perfectly.

MongoDB php extension install on ubuntu 12.04: fatal error: Zend/zend_string.h: No such file or directory

I've been trying to install a php 5.6 driver for mongodb on Ubuntu 12.04. (Will be using this on a Zend Framework 1.11 system, yes this is old, I am fully aware).
I've tried a few things, nothing works.
It seems I should get it to work using this installation:
http://php.net/manual/en/mongodb.installation.manual.php
But for some reason at the make all -j 5 step I get the following error:
In file included from /var/mongotest/mongo-php-driver/src/bson.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
compilation terminated.
In file included from /var/mongotest/mongo-php-driver/src/bson-encode.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
Just install php5.6-dev, it includes all the header files.

MacPorts PHP 5.5 ftp_ssl_connect() not available

I want to use PHP's ftp_ssl_connect() on my Mac, but I'm getting an error message that the function is not available:
PHP Fatal error: Call to undefined function ftp_ssl_connect()
I've installed Apache and PHP through MacPorts. I'm using PHP version 5.5.23. I've added FTP and OpenSSL support by running:
port install php55-ftp php55-openssl
I've already tried restarting Apache. In PHPInfo() it does say my install supports both FTP and OpenSSL, but still I'm getting the error message above when trying to use ftp_ssl_connect().
How can I enable this function on my machine?

Categories