Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Okay, so normally my sysadmin takes care of this, but he's been rather slack lately and I cannot wait any longer.

I've used PECL to install PHP's ssh2 extension. I've put the extension=ssh2.so in the php.ini and checked the ssh2.so is in the extension_dir. When I php -m | grep ssh2, it displays ssh2. When I run this script:

<?php

if (function_exists('ssh2_connect'))
{
    echo "true";
}

?>

and run it from the command line, it echos true.

When I run phpinfo() through the webserver, I can't find ssh2 anywhere. When I run ssh2_connect() through the webserver, it tells me that the function is undefined.

My OS is CentOS 5.7 PHP Version 5.2.14 nginx/0.7.67

I've been looking all over Google and tried everything I could find, but I can't figure it out. Can anyone help?

EDIT:

Just to keep you guys updated, Shish was right. I found a program php-fpm, that when called, seems to be what I'm looking for. However, it's failing to load the ssh2 extension due to mismatched API numbers

Starting php_fpm 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
 done

After some short research, it seems it might be an issue of me installing the ssh2 module via PECL, and I believe my sysadmin compiled PHP from source.

Looking into it now.

EDIT:

After additional research, it appears two versions of PHP are installed on my system. One that I probably installed via yum, and one that my sysadmin probably installed. It appears php-fpm is loading the one he installed, and naturally my updates aren't affecting it. Perhaps I'll wait for him in case I screw something up.

EDIT:

On second thought, I'm just going to remove everything and try it myself. At worst I'll just need to get him to reinstall everything, and at best it'll work and I won't have to wait for him any longer. Wish me luck.

EDIT:

Nope. Scratch that. No idea what I'm doing. I think I hate my life. I have about 30 tabs open in Chrome now. I'm going to bed. Hopefully someone can provide further insight while I sleep.

EDIT:

Yup, probably destroyed everything. Gonna try to repair my damage and then let my sysadmin handle it again. Going to accept the current answer because, well, it was right. Past that was just problems with the module API mismatch.

share|improve this question
1  
Let your sysadmin handle it! You're messing with an old version of PHP that's no longer supported by PHP, you definitely should not be doing that. Have your sysadmin clean up the install so that you only have one PHP version. You should probably also have Nginx updated while you're at it. –  Martin Fjordvald Jan 15 '12 at 18:25
    
Yeah, I've probably just completely messed it all up. Just tired of waiting on him. It's been half a month. I'ma try to fix my damage and then just hand it all back to him. -_- –  Rob Jan 15 '12 at 18:32
    
Fire him and get a new one? –  Martin Fjordvald Jan 16 '12 at 12:55
add comment

1 Answer

up vote 3 down vote accepted

You'll need to restart the PHP daemon - if the web server is nginx, then PHP is probably running as fastcgi or under PHP-FPM. Unfortunately I don't know CentOS to know the exact command to use to restart that daemon...

share|improve this answer
    
I'll look into it, but I've restarted the server multiple times. I'd imagine that would have done it. –  Rob Jan 15 '12 at 11:49
    
Looking into it, you're definitely onto something. –  Rob Jan 15 '12 at 11:55
    
Yup. My sysadmin appears to have that set up. But now another problem. Gonna do some searching and if I still can't get it working, I'll edit my question –  Rob Jan 15 '12 at 12:00
add comment

Your Answer

 
discard

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.