Call to undefined function http_post_data()

After updating my server from testing to Squeeze it suddenly crashed after running a high CPU % perl script.

Being unresponsive I reset the machine to reboot it.

After booting up and testing websites running on it I came along an odd PHP error;

Call to undefined function http_post_data()

Probably due to PHP updates from Lenny/testing to Squeeze.

This error is caused by not having installed PECL-HTTP (and php-pear php5-dev libcurl3-openssl-dev)

However, PECL-HTTP had been installed for ages and running the pecl install command resulted in this:

# pecl install pecl_http
pecl/pecl_http is already installed and is the same as the released version 1.7.0
install failed

Some quick Googling didn’t come up with a simple fix.

I then tried to reinstall PECL-HTTP (by uninstalling and reinstalling it)

# pecl uninstall pecl_http
Unable to remove "extension=http.so" from php.ini
uninstall ok: channel://pecl.php.net/pecl_http-1.7.0
# pecl install pecl_http
downloading pecl_http-1.7.0.tgz ...
Starting to download pecl_http-1.7.0.tgz (173,979 bytes)
[...]

Which luckily did solve my issue…

So reinstalling does actually solve stuff on Linux 😡

Be sure to have extension=http.so in your php.ini and to restart php if it’s running with fastcgi or restarting Apache after making the changes.

Leave a Reply...