Warning: Failed to open stream

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phphunger
Forum Commoner
Posts: 45
Joined: Tue Aug 11, 2009 11:56 pm

Warning: Failed to open stream

Post by phphunger »

Hi,

Can anyone solve the problem of mine. When i run my script the folowing error persists..

Code: Select all

Warning: include(../dbconfig.php) [function.include]: failed to open stream: No such file or directory in C:\xampp\htdocs\SuperFastSMS\Clients\QuickSMS.php on line 41
 
Warning: include() [function.include]: Failed opening '../dbconfig.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\htdocs\SuperFastSMS\Clients\QuickSMS.php on line 41
Griven
Forum Contributor
Posts: 165
Joined: Sat May 09, 2009 8:23 pm

Re: Warning: Failed to open stream

Post by Griven »

That means it cannot find the dbconfig.php file. With just one set of double dots, it's looking in the SuperFastSMS folder. You may have to add more ../ onto it if it's further up the file structure.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Warning: Failed to open stream

Post by jackpf »

Or use an absolute reference.
uyewq
Forum Newbie
Posts: 22
Joined: Thu Sep 17, 2009 6:21 am

Re: Warning: Failed to open stream

Post by uyewq »

for the inclusion, path problems:

after complexity increases i used my method below. now, i am happy with this method because
it has an advantage to easily transfer your files in future & all links are absolutely will be working without much effort

i include below file to my pages
<?php
/* php include("{$rootfolder}php/examplefile.php");?> */
$rootfolder = "/home/username/public_html/"; // it can be different in your system maybe
/*<link rel="stylesheet" href="<?php echo $belowfolder; ?>css/dis.css" type="text/css">*/
$belowfolder = "/";
?>
in future if i transfer all my portal from root to folder 'transfer' then
$belowfolder becomes = "/transfer/"
$rootfolder becomes = "/home/username/public_html/transfer/";

hope it gives some idea
Post Reply