Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to install the ssh2 extension for PHP, and after hours of working on it, I've near figured it out. I think.

It's compiled and the is in the correct directory and all. The problem, I believe, is version mismatches.

Here's the error it's spouting for me:

PHP Warning:  PHP Startup: ssh2: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP    compiled with module API=20060613, debug=0, thread-safety=0
These options need to match
 in Unknown on line 0

I'm pretty much at a dead end. How can I get the correct ssh2 module API?

share|improve this question
up vote 1 down vote accepted

Welp, I've figured it out. I installed PEAR, and from there used pecl to install it for the correct API.

I am king.

share|improve this answer
It's good to be king. – Wesley Jan 16 '12 at 1:24
That it is, @WesleyDavid. That it is. – Rob Jan 16 '12 at 1:40
To help others that are having this issue, once PEAR is installed run: pecl install -f ssh2 – Jeremy May 18 at 15:55

If installing via PEAR is not an option, as it was not for me, but you still are suffering the API Mismatch errors when you are compiling apache modules, understand that you must use the correct phpize:


And the correct configure option if you have more than one php version installed:

./configure --with-php-config=/usr/local/php53/bin/php-config
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.