Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:28:20+00:00 2026-06-10T14:28:20+00:00

I read some other posts here on stackoverflow about passing parms to a class

  • 0

I read some other posts here on stackoverflow about passing parms to a class library (for example, How to pass multiple parameters to a library in CodeIgniter?) and I also read the user manual under the libraries section.

What I’m wondering is if it’s possible to pass parameters as individual variables and not as an array?

My class – which I want to use outside of my codeigniter solution- look like this:

 <?php

     class ABC
     {


     private $_hostname;
     private $_password;
     private $_username;
     private $_connection;
     private $_data;
     private $_timeout;
     private $_prompt;


public function __construct($hostname, $password, $username = "", $timeout = 10) 

{
    set_include_path(get_include_path() . PATH_SEPARATOR . '/var/www/phpseclib');
    include('Net/SSH2.php');

    $this->_hostname = $hostname;
    $this->_password = $password;
    $this->_username = $username;

} // __construct

    public function connect()
    {
    }

    public function dosomething()
    {
    }

I know I can do something like :

   $params = array('_hostname' => $ip, '_password' => 'password', '_username' => '');
$this->load->library($classname,$params );

But I do not want to use arrays because this class will be reused by non CI solutions.
I’ve tried reverting to using a standard include() statement. So the code looks like:

      set_include_path(get_include_path() . PATH_SEPARATOR . 'var/www/myCIapp/application/libraries');
      include_once('libraries/'.$classname.'.php');

But it’s complaining saying that it cannot find the include file. The specific message is:

A PHP Error was encountered

Severity: Warning

Message: include_once() [function.include]: Failed opening
‘libraries/HP5406_ssh.php’ for inclusion
(include_path=’.:/usr/share/php:/usr/share/pear:var/www/myCIapp/application/libraries/’)

Filename: models/ss_model.php

Line Number: 88

Any suggestions would be appreciated. Thanks for reading…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:28:21+00:00Added an answer on June 10, 2026 at 2:28 pm

    A simple way of doing your include could be dome using the CI APPPATH CONSTANT:

    include_once(APPPATH.'libraries/'.$classname.'.php';
    

    This CONSTANT is set in the index.php by CodeIgniter so you know it’ll always be pointing to your Application directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I read some useful posts here on SO about previous maven questions, I'm currently
I've read a few other posts like this one about avoiding repetition in Java
A read some posts here and google and don´t find a substancial answer. Supose
I have read a few other posts on Stack Overflow and did some Googling
I've read through some other posts that were similar but I can't seem to
I've read a million posts on stackoverflow about nstimers, runloops and the main thread
GLib/GIO offer some great ways to print messages, read files and do some other
I read some articles about Comet tech. All of them mentioned that the long-life
I want to redirect a url pattern like http://abcd.com/some/sub/directory/var1 to http://abcd.com/some/sub/directory/?search=var1 I've read other
I've read a couple of the other posts on this issue, but seemed to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.