Uncaught Error: Call to undefined function curl_init() - php

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.

Related

Why my module (rrd module) in phpinfo() is enabled but im still getting php error of "PHP Warning: PHP Startup: Unable to load dynamic library 'rrd'?

I am using php v7.4, I just do what https://www.php.net/manual/en/rrd.installation.php says me to do but php cant see my php_rrd.dll file extension that I downloaded in PECL in C:\xampp\php\ext (my extension_dir is correct). When I do php -m I got a warning:
Image of my error. but in my phpinfo() it appears that it is already enabled. When I tried to run my program in postman I got an error of "Attempted to call function "rrd_graph" from namespace "App\Service" which means that it cant still load my module that I installed. I am using XAMPP on windows.
"

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

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.

Zend Server 8 PDO could not find driver via CLI

I installed Zend Server 8, and I need to run scripts that use MySQL via the command line.
I get this error when I run one of my CLI scripts:
PDOException
could not find driver
But everything works via http, problem only occurs in CLI. I know there is a different php.ini for the CLI. However, when i reference the php.ini that the server uses for http like this:
php -c/usr/local/zend/etc/php.ini my-script
I get this:
Warning: PHP Startup: Unable to load dynamic library
/usr/local/zend/lib/php_extensions/pdo.so' -
/usr/local/zend/lib/php_extensions/pdo.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library /usr/local/zend/lib/php_extensions/readline.so' - /usr/local/zend/lib/php_extensions/readline.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Fatal error: Class 'PDO' not found in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155
I have no idea how to troubleshoot this. I use Ubuntu 14.04 if that makes a difference.
It might also be useful to say that I installed LAMP first like this:
sudo apt-get install lamp-server^ and then I installed Zend Server
Any suggestions?
Thank you.
I ended up just changing the php alias to the php that was installed by Zend Server like this:
alias php=/usr/local/zend/bin/php
This seems to work, but still looking for a better/proper solution.

Unable to load dynamic library openssl.so

I just set up PHP and Apache on a Mac 10.8 localhost. So far it works fine.
I am now installing Symfony2. When I run the Composer install command, I get the following error :
$ curl -s http://getcomposer.org/installer | php
#!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl
I uncommented the following line in php.ini :
extension=php_openssl.dll
But I still get the same error, preceded by this message :
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll' - dlopen(/usr/local/lib/php/extensions/no-debug-non-zts-20131226/php_openssl.dll, 9): image not found in Unknown on line 0
There's no openssl.so file in my /usr/local/lib/php/extensions/no-debug-non-zts-20131226/ folder indeed.
I tried reinstalling php but it made no difference. I googled for hours yet I couldn't find a way to recompile php with --with-openssl. Any help would be of great value.

Unable to load dynamic library '/usr/lib/php5/20090626/svn.so'

Following installation of PageSpeed prerequisites, running this command on Ubuntu 11.10
php -V
receives the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626/svn.so' - libsvn_client-1.so.0: cannot open shared object file: No such file or directory in Unknown on line 0
I commented out the following line from /etc/php5/conf.d/svn.ini, which of course stopped the error. However I would still like to know what I need to do to resolve this error in order to include the extension?
extension=svn.so
Thanks! Any help is greatly appreciated.
You need to first install the package:
sudo apt-get install php5-svn

Categories