Jump to content

[SOLVED] How can I use the CLI to load a module?


miseleigh

Recommended Posts

I've been trying to use the php_ssh2 module, and have been having trouble getting it to load.  Through the live chat here someone linked me to a site that suggests that Apache simply doesn't like this module, and has a workaround for it, but he didn't go into much detail for the workaround.  He says that the "php_ssh2 module WILL load from php CLI script", and so his workaround was to call a CLI script from his PHP code that loads the module.  I've been trying to do this, but I must not be doing it right, cuz it's not working.

 

This is how I'm doing it:

 

On the webpage:

exec('SSH/load_module.bat');
$connection = ssh2_connect($ip[0]);

 

load_module.bat:

/php5.0/php.exe -c /php5.0/phpcode/php.ini load_module.php

 

and then load_module.php:

<?  dl('php_ssh2.dll');  ?>

 

And then I get the error 'Call to undefined function ssh2_connect()'.

 

So I don't really know what I'm doing when it comes to CLI stuff, and executing them from PHP, so any help would be awesome.

Link to comment
Share on other sites

Through the live chat here someone linked me to a site that suggests that Apache simply doesn't like this module

 

If a module should'nt be loaded into mod_php it is usually mentioned in the manual, there is no mention of this in regard to ssh2.

 

Anyways, what you have done will load the module into the cli. Exec runs in a completelt seperate process to mod_apache. You'll need to call your entire script, via exec.

Link to comment
Share on other sites

Well, I know the module should work, but it looks like the module isn't getting a function from one of the windows .dlls that it expects, and I just can't get it to load that way.  ("Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.")  I might be able to fix that if I could figure out which module is causing the problem, but I haven't been able to.

 

So back to this.  You're saying that loading a module in through the CLI doesn't affect Apache at all, even if I run it through Apache, so I'll have to write my ssh functions as CLI scripts?  Is there a way I can get the results back from those scripts that way?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.