8

I keep getting this error:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/http.so' - /usr/lib64/php/modules/http.so: undefined symbol: php_persistent_handle_abandon in Unknown on line 0

PHP Fatal error: Class 'HttpResponse' not found in /var/www/api/init.php on line 4

I've reinstalled http through pecl a few times, even tried installing it from the tar.gz. I'm running an EC2 instance.

I HAVE put extension=http.so in my php.ini.

4
  • How did you install php? I often see this with multiple php installs with inconsistent module locations.
    – datasage
    Feb 27, 2014 at 20:55
  • I installed php using yum. I have php 5.3. I just tried downgrading to pecl http 1.6.7, which worked, but now I can't find http.so Feb 27, 2014 at 21:16
  • Did you install pecl via yum as well?
    – datasage
    Feb 27, 2014 at 21:19
  • possible duplicate of pecl_http faild to load Apr 29, 2015 at 11:00

4 Answers 4

11

You probably got version 2 of pecl_http, and it has some new requirements. See the installation instructions. For me these lines worked:

extension=raphf.so
extension=propro.so
extension=http.so

Edit: Order matters, so first try the same order as I used.

I also made sure http.so is loaded after json.so and the other prerequisites.

1
  • 4
    Make sure that this is the exact order when you list in php.ini
    – Arjan
    Jul 18, 2014 at 8:37
5

I installed pecl_http successfully with following steps on Debian

  1. execute sudo pecl install raphf propro pecl_http
  2. create /etc/php5/mods-available/zhttp.ini extension=raphf.so extension=propro.so extension=http.so
  3. execute sudo php5enmod zhttp
  4. restart your web server
1
  • Running php -r 'http_post_data();' still gives me Call to undefined function http_post_data()
    – Jonathan
    Apr 13, 2015 at 22:18
2

As mine was using /etc/php/conf.d/ for the additional .ini files I just prefixed them with numbers

mv raphf.ini 1raphf.ini
mv propro.ini 2propro.ini
mv http.ini 3http.ini


# php --ini
Configuration File (php.ini) Path: /etc/php
Loaded Configuration File:         /etc/php/php.ini
Scan for additional .ini files in: /etc/php/conf.d
Additional .ini files parsed:      /etc/php/conf.d/1raphf.ini,
/etc/php/conf.d/2propro.ini,
/etc/php/conf.d/3http.ini,
/etc/php/conf.d/imagick.ini
2
  • actually http.ini should really load at the very end of all other extensions. I renamed it to zzzhttp.ini instead and it solved another issue I had.
    – Sebas
    Aug 9, 2016 at 21:48
  • oh man!, thanks a lot. This worked. Wasted hours and hours.. sigh
    – Viraths
    Jan 4, 2017 at 3:51
-1

This solution have worked for me on php7.2-fpm

<?php
$db_host = "localhost";
$db_user = "xxxx";
$db_pass = "xxxx";
$connect = mysqli_connect($db_host,$db_user,$db_pass);
$db_name = "xxxx";

$db_select = mysqli_select_db($connect, $db_name);

// Empty table
$query = "TRUNCATE TABLE xtabletotruncatex";
mysqli_query($connect, $query);
?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.