unable to connect multiple database in codeigniter - php

i have two database in a single project. I am trying to connect with the second database for generating one query but it is throwing error on my console. Please help me with this problem
Below Model code i used
//---------connecting with 2nd db--------------------------------------------
public function fetch_all_approved_template_list($limit,$start)
{
$dsn = 'mysql://fitappweb:fitappweb#localhost/fitneapp_webapp';
$dsnDB = $this->load->database($dsn, TRUE);
$dsnDB->limit($limit, $start);
$query = $dsnDB->order_by('routine_id', 'DESC')->join('userdetails', 'userdetails.user_id = template_routines.creater_id')->get_where('template_routines',array('status_code'=>'1'));
$data=array();
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
Error On the browser window
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(application/errors/error_php.php): failed to open stream: No such file or directory in D:\xampp\htdocs\system\core\Exceptions.php on line 182
Warning: include(): Failed opening 'application/errors/error_php.php' for inclusion (include_path='.;D:\xampp\php\PEAR') in D:\xampp\htdocs\system\core\Exceptions.php on line 182

error_php.php in a codeigniter application usually contains:
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: <?php echo $severity; ?></p>
<p>Message: <?php echo $message; ?></p>
<p>Filename: <?php echo $filepath; ?></p>
<p>Line Number: <?php echo $line; ?></p>
</div>
you can place this in your application/errors/error_php.php file. And you will get more details as to what the errors being generated are.

Have you tried setting up the group name in the config file?
After that then you would only have to call it by the group name
$this->load->database('group_name');

Check application/config/databases.php for setting up your database next you can load the database using
$this->load->database('group_name',TRUE);
Read this to manually connect :
http://ellislab.com/codeigniter/user-guide/database/connecting.html
You need to pass an array when loading your DB.
I wouldn't advise connecting manually but your choice.

Related

include_once failed to open stream and Warning: include_once(): Failed opening.for inclusion (include_path='.:/usr/share/pear:/usr/share/php')

I am getting below error . I have already tried with dir , document root, require_once and require.
This error i am getting in Live Server.
Warning: include_once(/storage/ssd1/655/2980655/public_html/Lib/DB//MysqliDb.php): failed to open stream: No such file or directory in /storage/ssd1/655/2980655/public_html/index.php on line 8
Warning: include_once(): Failed opening '/storage/ssd1/655/2980655/public_html/Lib/DB//MysqliDb.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /storage/ssd1/655/2980655/public_html/index.php on line 8
Thank you in Advance.

Failed opening '/adodb5/adodb.inc.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\crmsv2\login.php

Warning: include(/adodb5/adodb.inc.php): failed to open stream: No such file or directory in C:\xampp\htdocs\crmsv2\login.php on line 3
Warning: include(): Failed opening '/adodb5/adodb.inc.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\crmsv2\login.php on line 3
Warning: include(/config/config.php): failed to open stream: No such file or directory in C:\xampp\htdocs\crmsv2\login.php on line 4
Warning: include(): Failed opening '/config/config.php' for inclusion (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\crmsv2\login.php on line 4

phpseclib gives me a strange erros

Im trying to use this, but it just gives me this errors and i have no clue how to fix that..
Warning: include_once(Math/BigInteger.php): failed to open stream: No
such file or directory in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 891
Warning: include_once(): Failed opening 'Math/BigInteger.php' for
inclusion (include_path='.:/usr/share/php:/usr/share/pear') in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 891
Warning: include_once(Crypt/Random.php): failed to open stream: No
such file or directory in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 895
Warning: include_once(): Failed opening 'Crypt/Random.php' for
inclusion (include_path='.:/usr/share/php:/usr/share/pear') in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 895
Warning: include_once(Crypt/Hash.php): failed to open stream: No such
file or directory in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 899
Warning: include_once(): Failed opening 'Crypt/Hash.php' for inclusion
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 899
Warning: include_once(Crypt/Base.php): failed to open stream: No such
file or directory in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 904
Warning: include_once(): Failed opening 'Crypt/Base.php' for inclusion
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 904
Fatal error: Call to undefined function
phpseclib_resolve_include_path() in
/home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on
line 1226
include('Net/SSH2.php');
$ssh = new Net_SSH2('host');
if (!$ssh->login('user', 'pass')) {
echo('Login Failed');
}
$ssh->exec('the cmd line...");
$ssh->disconnect();
phpseclib is probably not in your include_path. Quoting phpseclib.sourceforge.net,
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
include('Net/SSH2.php');
?>
You'll need to adjust that as appropriate. If phpseclib is in the vendor/phpseclib directory then do 'vendor/phpseclib' instead, etc.
Yep, you need set_include_path.
And, in my way I've replace in ssh2.php all include directive
include_once(Math/BigInteger.php)
on
stream_resolve_include_path(Math/*****.php)
For CodeIgniter <=3,
set_include_path(get_include_path() . PATH_SEPARATOR . APPPATH.'libraries/phpseclib');

Cpanel PHP Update, problems with loading

after my hosting provider updated their PHP in cpanel, my site cannot load its php files, someone else made these file and i am trying to detect what the problem might be, here is the output of executed php:
Warning: include(folder_include/config.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 2
Warning: include(folder_include/config.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 2
Warning: include() [function.include]: Failed opening 'folder_include/config.php' for inclusion (include_path='.:/opt/php52/lib/php') in /home/website/public_html/v3/folder_include/classes.php on line 2
Warning: include(folder_include/class.database.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 3
Warning: include(folder_include/class.database.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 3
Warning: include() [function.include]: Failed opening 'folder_include/class.database.php' for inclusion (include_path='.:/opt/php52/lib/php') in /home/website/public_html/v3/folder_include/classes.php on line 3
Warning: include(folder_include/class.misc.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 4
Warning: include(folder_include/class.misc.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 4
Warning: include() [function.include]: Failed opening 'folder_include/class.misc.php' for inclusion (include_path='.:/opt/php52/lib/php') in /home/website/public_html/v3/folder_include/classes.php on line 4
Warning: include(folder_include/class.website.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 5
Warning: include(folder_include/class.website.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 5
Warning: include() [function.include]: Failed opening 'folder_include/class.website.php' for inclusion (include_path='.:/opt/php52/lib/php') in /home/website/public_html/v3/folder_include/classes.php on line 5
Warning: include(folder_include/class.korpa.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 6
Warning: include(folder_include/class.korpa.php) [function.include]: failed to open stream: No such file or directory in /home/website/public_html/v3/folder_include/classes.php on line 6
Warning: include() [function.include]: Failed opening 'folder_include/class.korpa.php' for inclusion (include_path='.:/opt/php52/lib/php') in /home/website/public_html/v3/folder_include/classes.php on line 6
Regards
We need to see these lines to know the problem, but probably the function syntax or name was changed.

PHP page with several includes only showing one

Im very new to php and i have a page with 5 includes located in a directory (called includes) one above where my page is held (called contact
My File Structure is like this
|Index.php (includes workfine)
|Includes
|Contact|index.php
The Index.php in the contact folder only seems to show the form2.php include
<?php include("../../head.php"); ?>
</head>
<body>
<?php include("../../header.php"); ?>
<!-- container -->
<div id="container" class="container_12">
<!-- full width Header-->
<?php include("../../billboard.php"); ?>
<!-- Main Content-->
<div class="grid_8">
<?php include("../form2.php"); ?>
<div class="clear"></div>
</div> <!--main content close-->
<!-- Side Bar-->
<?php include("../../sidebar1.php"); ?>
</div>
</div>
<!--containter close-->
<div id="topspace" class="grid_12"></div>
<?php include("../footer.php"); ?>
</body>
</html>
Errors that appear:
Warning: include(../../head.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20
Warning: include(../../head.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20
Warning: include() [function.include]: Failed opening '../../head.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 20
Warning: include(../../header.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26
Warning: include(../../header.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26
Warning: include() [function.include]: Failed opening '../../header.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 26
Warning: include(../../billboard.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33
Warning: include(../../billboard.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33
Warning: include() [function.include]: Failed opening '../../billboard.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 33
Need To Talk About A Mortgage? We Can Contact You..
(form2.php appears here)
Warning: include(../../sidebar1.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54
Warning: include(../../sidebar1.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54
Warning: include() [function.include]: Failed opening '../../sidebar1.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 54
Warning: include(../footer.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67
Warning: include(../footer.php) [function.include]: failed to open stream: No such file or directory in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67
Warning: include() [function.include]: Failed opening '../footer.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/superinj/public_html/gholami.co.uk/callback/index.php on line 67
I have access to two servers and have tried uploading to both and both times get the error
What am i missing?
Thanks
If it's one directory above, use ../ instead of ../../
Example:
<?php include("../head.php"); ?>
That is why the form appears and the others don't :)
Looks like you forgot to put the "/Includes/" in your paths
<?php include("../Includes/head.php"); ?>

Categories