php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21674 Warning: main(lang.php) [function.main]: failed to create stream: No such file
Submitted: 2003-01-15 22:10 UTC Modified: 2003-04-02 08:20 UTC
Votes:7
Avg. Score:4.1 ± 1.4
Reproduced:7 of 7 (100.0%)
Same Version:7 (100.0%)
Same OS:1 (14.3%)
From: moderator at blackpeeps dot com Assigned:
Status: Closed Package: *URL Functions
PHP Version: 4.3.0 OS: Cobalt RAQ4 Apache/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
16 - 5 = ?
Subscribe to this entry?

 
 [2003-01-15 22:10 UTC] moderator at blackpeeps dot com
Warning: main(lang.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 97

Just upraded to 4.3.0 from 4.1.2 
Issue involves the following:

Same server
Two (2) seperate virtual domains
Scripts worked find before upgrade.

I am running a local php script located at 
/home/sites/site3/web/powerpage.php 

powerpage.php has a line that does a require_once to a remote file config.php located on (same server) located at 
/home/sites/site2/web/IV/config.php

Sample:
require_once ("/home/sites/site2/web/IV/config.php");
langtop();

The followng errors occur when I now try to run this local script 
Warning: main(lang.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 97

Warning: main() [function.main]: Failed opening 'lang.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 97

Warning: main(extras.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 98

Warning: main() [function.main]: Failed opening 'extras.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 98

Fatal error: Call to undefined function: langtop() in /home/sites/site3/web/powerpage.php on line 3

Problem: The file does exist

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-17 12:27 UTC] moderator at blackpeeps dot com
Test this code if you will:

// Start- Copy and Save this code as phpbug21674.php in a path folder name "site3"
<?
// PHP BUG# 21674
// This script must be saved to Docs root path of virtual domain-A

// To debug.. change the path to the path on your test server
require_once ("/home/sites/site2/config.php");

echo "Hello - Testing PHP 4.3.0 bug# 21674<br>";
?>
// End - Copy and Save this code as phpbug21674.php

// Begin - Copy and Save this code as config.php in a path folder name "site2"

<? 
include ('extras.php');

?>
// End - Copy and Save this code as config.php


// Begin - Copy and Save this code as extras.php in a path folder name "site2"

<?
// -- field definitions --

$extra=array();   // leave this line alone

$extra[info1][name]="Alias Name/Nickname";
$extra[info1][type]="text";

$extra[info2][name]="Your Gender";
$extra[info2][type]=array("Female","Male",);

$extra[info3][name]="Relationship Status";
$extra[info3][type]=array("Single","Single-Looking for Couples","Couple-Looking for Singles","Dating","Involved/Partner","Involved-Seeking New Friends","Married","Married-Seeking Discreet Friend","Engaged","Divorced","Widowed","Player","Just looking for friend","Just Looking for Sex Partner","Undecided");

$extra[info4][name]="Sexual Orientation";
$extra[info4][type]=array("Heterosexual","Gay","Lesbian","BiSexual","BiCurious","Rather Not Say");


// do not edit past this line

$extras = array();
for ($i=0; $i < 21; $i++)
 { $marker = "info".$i; // print $marker."<br>"; // debug
 if (strlen($extra[$marker][name]) > 1)

  $extras[]=$marker;
 }


// in general, to display extra variable values, use $extra[infox][value]

?>


Now execute php21674.php to reproduce errors.
 [2003-01-17 12:48 UTC] wez@php.net
It works fine here...
Is your include_path still '' ?
You *must* have '.' in your include path for relative includes to work; have you tried that?
 [2003-01-17 12:59 UTC] moderator at blackpeeps dot com
This is what my phpinfo() says

include_path         .:/usr/lib/php
 [2003-01-17 13:03 UTC] wez@php.net
add:
var_dump(ini_get('include_path'));
to the line before the require_once in the phpbug21674.php script and paste the output here.
 [2003-01-17 13:36 UTC] moderator at blackpeeps dot com
Here are the results to your request.

string(14) ".:/usr/lib/php" 
Warning: main(lang.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 97

Warning: main() [function.main]: Failed opening 'lang.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 97

Warning: main(extras.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 98

Warning: main() [function.main]: Failed opening 'extras.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 98
Hello - Testing PHP 4.3.0 bug# 21674// End - Copy and Save this code as phpbug21674.php
 [2003-01-17 13:50 UTC] wez@php.net
Can you do the same for the config.php file.
(and look to see if you have some .htaccess file in there too that might be changing PHP settings)
 [2003-01-17 14:11 UTC] moderator at blackpeeps dot com
OK. At your request, here are my results.

string(14) ".:/usr/lib/php" string(14) ".:/usr/lib/php" 
Warning: main(lang.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 97

Warning: main() [function.main]: Failed opening 'lang.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 97

Warning: main(extras.php) [function.main]: failed to create stream: No such file or directory in /home/sites/site2/web/IV/config.php on line 98

Warning: main() [function.main]: Failed opening 'extras.php' for inclusion (include_path='') in /home/sites/site2/web/IV/config.php on line 98
Hello - Testing PHP 4.3.0 bug# 21674// End - Copy and Save this code as phpbug21674.php
 [2003-01-17 14:23 UTC] wez@php.net
and can you confirm that the var_dump(ini_get('include_path')) is on the line immediately above the include that fails?

I'm asking because the line numbers in the report don't seem to have changed, and I would have expected them to at least have increased by 1.


 [2003-01-17 15:59 UTC] moderator at blackpeeps dot com
You did not ask me to place above line that include fails. You asked me to place above require_once in the config.php file. That I can confirm.
 [2003-01-22 05:00 UTC] wez@php.net
Just to be extra sure:

in config.php, do lines 97 and 98 look like this:

var_dump(ini_get('include_path'));
include ('extras.php');

If not, please make sure they do and report back.
If they do, then something really strange is going on.
 [2003-01-22 10:38 UTC] moderator at blackpeeps dot com
Hello Wez:

Not it does not look like that.  I was asked to include var_dump(ini_get('include_path'));

before the require_once statement in the primary script, phpbug21674.php

Remember there are two scripts located in different paths representing two different virtual domains.

/home/site3/phpbug21674.php (contains a require_once ("/home/sites/site2/web/IV/config.php");

and /home/sites/site2/web/IV/config.php" ---> contains
include_once ('lang.php');
include ('extras.php'); 

However, I did go back and also added the var_dump to config.php to reflect as follows:

var_dump(ini_get('include_path'));
include_once ('lang.php');
include ('extras.php'); 


Results: Same results = Failed to create stream:

Again, this script worked fine on PHP 4.1.2 Now it seems to get it to work, I have to reference the absolute path.
 [2003-01-22 22:25 UTC] philip@php.net
The point of asking for var_dump(ini_get('include_path')); is so you'll show the output of it.  This is a form of debugging.

The problem has to do with the include_path directive.  Now we're trying to figure out why/where it gets set to '' before doing some of these includes as this seems to be the case.

So, whenever you get this error:

Warning: main() [function.main]: Failed opening 'foo.php'...

Add this line above the include:

var_dump(array(ini_get('include_path'),__LINE__,__FILE));

This way we'll know some useful information.  Basically put this line above EVERY one of these failed includes, such as the inclusion config.php, extra.php, and lang.php.  

Please do this and show the output in your next reply.  Btw, I modified Wez's debug dump a little so we can be a little more specific :)  Also, be 100% sure you are not setting this directive in either httpd.conf or .htaccess.
 [2003-04-02 08:20 UTC] wez@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC