Trying to use popen w/ ssh2_connect and having problems...
Posted: Tue Oct 13, 2015 3:16 pm
Long story short, I've used open() to fork processing. The new thread uses another PHP file that calls ssh2_connect(). I'm not sure what's happening but it's not working and claims that ssh2_connect() is undefined.
Here's what's in index.php:
And here's what's in "forked.php":
Is there something wrong with php-win.exe being unable to use certain PHP functions when done using something like popen()? This worked when I used PHP 5.3 (or at least, I remember it working) but when I switched over to PHP 5.5.12, it just doesn't. The really strange thing is that calling ssh2_connect() from the main thread (not forking it) works without a single problem.
Any help with this would be appreciated.
Here's what's in index.php:
Code: Select all
error_reporting(E_ALL);
$page = 'forked.php';
$handle = popen('start /B C:\wamp2.5\bin\php\php5.5.12\php-win.exe '.$page, 'r');
$read = fread($handle, 2096);
echo $read;
pclose($handle);Code: Select all
$connection = ssh2_connect('foobar.whatever.com', 22);
var_dump($connection);Any help with this would be appreciated.