Reputation: 5049
I have PHP code that signs request using openssl_sign:
if (($pkeyid = openssl_pkey_get_private($keystr)) === false)
{
$this->setError('Cannot retrieve private key from: ' . $this->getParam('keyFile'));
return false;
}
if (!openssl_sign($message, $sign, $pkeyid, OPENSSL_ALGO_SHA1))
{
$this->setError('Cannot sign with private key');
return false;
}
It is working normally when code is run in CLI, but under Apache (php 5.2.17 as module) line with !openssl_sign($message, $sign, $pkeyid, OPENSSL_ALGO_SHA1)
results in segfault (11).
$pkeyid = openssl_pkey_get_private($keystr)
gives valid key.
Have someone encountered such error? What is solution if any? Alternatives compliant with openssl_sign? How it could be rapidly diagnosed?
Upvotes: 0
Views: 734
Reputation: 213686
The most likely cause: both your PHP module and the apache httpd
itself are linked against libopenssl
, but different versions of it, causing symbols from the "wrong" library to get called.
Set ulimit -c unlimited
, let httpd
dump core
, and analyse it with gdb
:
gdb /path/to/httpd /path/to/core
(gdb) info shared
# look for more than one instance of openssl
(gdb) info func EVP_SignFinal
# look for more than one definition -- one could be statically linked into httpd
Upvotes: 2