I face an awkward problem:
Call to undefined function http_negotiate_language()
on a fresh installed server (ubuntu raring)
PECL correctly installed, php.ini updated
PECL modules are loaded without errors
and:
var_dump(extension_loaded('http')); // return true, everything is fine
I must miss something but what ?
You got version 2 of pecl_http, which dropped the function-style API. The supported call is now http\Env::negotiateLanguage (see the negotiateLanguage docs).
You can either update your code or try to run
# pecl uninstall pecl_http
# pecl install pecl_http-1.7.6
to downgrade.
Related
Lately, I have been trying to install the pecl memcache PHP extension on OSX Catalina with brew memcached installed and I'm getting the following error every time I try the install process:
configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
I have tried with pecl install memcache and with pecl install --configureoptions='with-zlib-dir="path"' memcache to no avail. It always gets the same point and it fails.
From what I have reviewed on different topics regarding the installation of the package the issue seems to be with the -D option in the pecl install command, because when I do a manual install from the source code passing the argument --with-zlib-dir=/usr/local/Cellar/zlib/1.2.11 to the ./configure command it works like a charm and installs the package but is now not listed in pecl list installed packages and as so it cannot be uninstalled.
The issue is I need pecl to manage the installation of the package to be able to uninstall it any time when the environment changes from project to protect.
A quick fix for this (found via https://bugs.php.net/bug.php?id=56522) is to use the PHP_ZLIB_DIR variable instead of --with-zlib-dir.
i.e. PHP_ZLIB_DIR=/usr/local/Cellar/zlib/1.2.11 pecl install memcache
I've struggled with the -D option before as well - near as I can tell it's completely broken.
I changed my default apache server setup on my mac to be able of easily switching between php versions following this guide.
Now, when I return to my project which is based on the CMS TYPO3, I get the error, that "The PHP extension "apcu" must be installed and loaded in order to use the APCu backend.".
So I was following the tutorial (by the same author) to install and enable apcu.
I can sum up the installation process:
$ sphp 5.6
$ brew install autoconf
$ pecl channel-update pecl.php.net
$ pecl install apcu-4.0.11
This actually worked perfectly for php 5.6! But I wanted php 7.2 for my project. The tutorial instructs to do this:
$ sphp 7.2
$ pecl uninstall -r apcu
$ pecl install apcu
No errors here. But the CMS still claims no apcu! Searching for "apc" in phpinfo also returns in no results! Pecl added the extension="apcu.so" line in the loaded php 7.2 ini, so I don't understand what's wrong. Of course I restarted apache every time. Also no errors or warnings here.
Also after googling I have no idea what to do :/
You may try using an absolute path of the apcu.so in php.ini,
Like
extension="/usr/local/Cellar/php/7.3.2/pecl/20180731/apcu.so"
The path depends. Don't know why but this works for me anyway.
You may also need to check the following ini config entry for apcu:
apc.enabled=on
apc.enable_cli=on
I need to encrypt passwords and some other data in my PHP(5.5.9) application on Ubuntu (14.04) server. I read about libsodium and found it a good fit for the applications requirements. I followed all the instructions given in the only tutorial available for libsoidum.
sudo add-apt-repository ppa:chris-lea/libsodium - Done, no errors
sudo apt-get update && sudo apt-get install libsodium-dev - Done, no errors
pecl install libsodium - Done, no errors
added extension=libsodium.so to php.ini and restarted apache.
When I check phpinfo() page I am able to see the entry for libsodium as follows:
libsodium support enabled
libsodium compiled version 1.0.6
libsodium headers version 1.0.3
libsodium library version 1.0.3
However, when I try to run the basic example given in the above tutorial which is:
<?php var_dump([ \Sodium\library_version_major(),\\Sodium\library_version_minor(),\Sodium\version_string() ]);?>
I get an error saying "Call to undefined function Sodium\library_version_major()".
This is really baffling me as the extension is identified correctly by phpinfo() page.
Can anyone please help me in understanding if I am missing something or doing wrong that I am not able to use libsodium with php. Any help is greatly appreciated.
Thank you.
I assume that you've tried to run the basic example from the command line. In this case it is necessary to not only add extension=libsodium.so to the php.ini of apache2 that is found at /etc/php5/apache2/php.ini on Ubuntu 14.04.
Additional it is necessary to add this line to the php.ini file for the cli environment found at /etc/php5/cli/php.ini.
I have centos 6.5 server and when I try to install php extension using pecl I get the following error:
XML Extension not found
All the documentations say that this extension is included by default... Why this error still exists?
According to a comment on php.net
Certain Linux distributions do not have this extension included in the minimum PHP package. It can usually be found in one of the "optional" php-* packages.
For CentOS, you will need to run yum install php-xml, which provides this extension.
So please try to install it using:
yum install php-xml
Also check your php.ini and make sure that the extension is not commented out with a ; it should be listed as:
extension=dom.so
In order to be absolutely sure whether or not a module is enabled you should use phpinfo()
Ubuntu 20.04 and phpV7.4 perfectly work. Try this one
sudo apt-get install php-xml
I have began installing pecl on MAMP. I have added the correct php version to the path and when which php it says /Applications/MAMP/... which is correct.
I have downloaded the Server Components and libraries moved them to a new folder in my php and run the ./configure everything seems to run ok and looked through all the checks being performed while installing and unpacking.
It gets to the last line and says;
configure: error: Please specify the install prefix of iconv with --with-iconv=<DIR>
Where should I set the <DIR> for the iconv?
Just make another folder and point it at that?
I am only trying to get the mongo pecl installed.
The information I have followed is here http://www.lullabot.com/blog/article/installing-php-pear-and-pecl-extensions-mamp-mac-os-x-107-lion
Wait wait wait wait. Why are you rebuilding your PHP installation to install the MongoDB driver?
You don't have to do that.
Just run e.g.:
/Applications/MAMP/bin/php/php7.1.1/bin/pecl install mongo
Assuming thats the full path to the pecl command part of your MAMP installation.
You might need to replace /php7.1.1/ with your current and active MAMP php version.
Working on this right now and found a workaround to just disable iconv with ./configure --without-iconv which not the best solution of course, but works for me.
Edit: Downloaded libiconv-1.14 package, and after running ./configure , make, make install, PHP configure runs fine.
This did it for me:
$ ./configure --with-iconv=/usr/lib/
First needed to install libxml2 and libxslt via homebrew though:
$ brew install libxml2
$ brew install libxslt