0

Added the following under Dynamic Extensions in both php.ini's (Apache's, and the normal one found with: sudo updatedb && locate php.ini)

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

Ran the following installs, which all worked:

sudo apt-get install libpcre3-dev php5-dev php-pear
sudo pecl channel-update pecl.php.net
sudo pecl install pecl_http

Yet testing it still fails

php -r 'http_post_data();'
PHP Fatal error:  Call to undefined function http_post_data() in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0

What am I missing?

Jonathan
  • 272
  • 1
  • 13

2 Answers2

2

Ran across the same issue myself. http_post_data() is provided by v1 of this PECL extension, not v2 which is the default to install.

Re-install via pecl install -f pecl_http-1.7.6

After that:

php -r 'http_post_data();'
PHP Warning:  http_post_data() expects at least 2 parameters, 0 given in Command line code on line 1
0

Ubuntu PHP usually comes with some help functions php5enmod and php5dismod. These map to enabling modules by name found in /etc/php5/mods-available and symlinking them as appropriate to /etc/php5/[SAPI]/conf.d, where the sapi is usually "cli", "fpm", or "apache2".

I would check to make sure the ini files you referenced, presumably found in /etc/php5/mods-available have been symlinked to /etc/php5/cli/conf.d and/or /etc/php5/apache2/conf.d. You can use sudo php5enmod -s ALL mod_name_here to create those symlinks for you for all SAPI's (cli, apache, etc). "mod_name_here" is usually the name of the INI file created minus the .ini extension portion.

I'm making some assumptions about your system though, for example I don't know if you've installed PHP from apt-get/aptitude or if you've compiled from source, so your mileage may vary.

fideloper
  • 353
  • 3
  • 11
  • I installed PHP through `sudo tasksel`. It was nice to be introduced to `php5enmod` , but even with that, I still get `Undefined function` – Jonathan Apr 13 '15 at 22:48