0

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?

1 Answer 1

2

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 
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. One question only - how I make httpd to dump core?
I decided just to recompile httpd, anyway, thanks for idea about different versions of lib in httpd and php.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.