System Checks: FILE directive supportet

soundrabbit

Joined: 2005-03-05
Posts: 2
Posted: Sat, 2005-03-05 10:41

<TYPE YOUR MESSAGE HERE, ENTER SYSTEM DETAILS BELOW>
<Please check the G2 FAQ (sticky topic in this forum) before posting!>
----

Gallery URL (optional):
Gallery version: G2 "dark fibre"
Webserver (with version): apache 1.3
Datatabase (with version): mysql standard 4.0.23
PHP version (eg 4.2.1): 5.0.3
phpinfo URL (optional):
Graphics Toolkit(s): netpbm
Operating system: Mac OS X
Web browser/version: Firefox 1.0.1
G1 version (for migration bugs): none

Hi

I get the following error message in the System Checks

FILE directive supported Failed
Error: your PHP __FILE__ directive is not functioning correctly. Please file a support request with your webserver administrator or in the Gallery forums.

What can I do about this?

Thanks
Lukas

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-03-05 11:04

Very strange. Can one disable the __FILE__ directive?
If your php version was 4.0.3, then i could imagine that this error can occur, because there were some strange issues with __FILE__ in 4.0.x, but with 5.0.3 this should not occur.
I also couldn't find any issues related to the combination 5.0.3/mac os x and __FILE__.

perhaps mindless or bharat know more.
starting points:
http://ch2.php.net/constants
http://ch2.php.net/manual/en/language.constants.predefined.php
http://bugs.php.net/bug.php?id=13936&edit=3 (bugs in __FILE__ directive in 2001, php version 4.2)

 
soundrabbit

Joined: 2005-03-05
Posts: 2
Posted: Sun, 2005-03-06 10:16

i get the same bug also with php 4.3.10

lukas

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2005-03-07 03:46

As far as I can tell, this is a bug in PHP. It's not one that we can work around, so if __FILE__ is broken there's not much we can do about it. If you give me ssh access to your box I can take a look and see if I can figure out what's going wrong (but the odds are that I won't be able to do anything since we check everything we can in the system check page).

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Sat, 2005-04-23 19:12

I also get this error with PHP Version 4.3.10.
G2 source code checked out via cvs about 10 minutes ago.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Sun, 2005-04-24 08:32

PS: An already running and yesterday via CVS updated G2 installation is still running!

I've tryd to disable the FILE Check through deleting the section in SystemCheck.class (or so... If I remember the filename correctly.. but u should know what I mean:) ). Then the Install process went on to write config.php. But this fails... of course, config.php exists and was writeable, but the installer says always that its not.

Maybe this cames from the FILE problem.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-24 10:32

rakso, the __FILE__ directive is too fundamental to ignore it. it's used in about every source file of G2. fix your php install, without passing the __FILE__ test, you'll end up with numerous of other errors during runtime.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Sun, 2005-04-24 11:13

Hm ok.. but I have (unfortunately) NO idea HOW to fix it!

(And the already installed G2 works!)

:-(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-04-24 11:25

get another php version, or the same version, fixed source, recompile or get a binary version. eg. 4.3.11 or a 5.0.x.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Sun, 2005-04-24 16:35

Okay, now I've installed PHP 4.3.11, but the same problem...

What is the "__FILE__ directive" ?? Where can I find information about it?! I've never heard about this before...

The other G2 installation stills runs...

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Sun, 2005-04-24 16:37
 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Sun, 2005-04-24 16:41

hm.. I'm not a programmer, so this is not very useful for me...
But.. WTF dont work it... :-(

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Mon, 2005-05-02 06:55

I don't have a solution yet.

How can a DEBUG-mode in gallery2 (installer) enbabled?
I hope, that I can see then more information about this failure...

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Mon, 2005-05-02 08:50

Did you restart apache after you made changes / updated php?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-05-02 10:00

debug mode is enabled in config.php (open config.php with a texteditor (wordpad,...) and change the debug mode line from false to buffered.

BUT... this won't help you in this case. the __FILE__ directive has nothing to do with G2, it's a fundamental PHP functionality. all we can say is that you should try other versions of php. perhaps the newest php from the 5.0.x series.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-06 00:49
valiant wrote:
BUT... this won't help you in this case. the __FILE__ directive has nothing to do with G2, it's a fundamental PHP functionality. all we can say is that you should try other versions of php. perhaps the newest php from the 5.0.x series.

inapprehensible.... verdammte scheisse.... *fluch*

With the fresh installed PHP 5.0.4 (FreeBSD ports) its the same problem.

In install/steps/SystemChecksStep.class there is the following code of interest:

function CheckFileDirective() {
if (strstr(__FILE__, 'install/steps/SystemChecksStep.class') ||
strstr(__FILE__, '\\install\\steps\\SystemChecksStep.class')) {
return true;
} else {
return false;
}
}

If I write above the if (...)

die('__FILE__ = ' . __FILE__);

then in the browser appears

__FILE__ = ./steps/SystemChecksStep.class

Now its clear why the check fails... because it checked for

install/steps/SystemChecksStep.class

__FILE__ should return a realative path.

maybe can the Gallery2 developers change a little bit the behaviour of their software? I cant beliefe that this g2 installer works on a server out in the world?!

:( :(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-05-06 00:56

rakso, no, that's not true.
see: http://ch2.php.net/manual/en/language.constants.predefined.php

__FILE__ should return the full path, that is the absolute path, of the file where it's called in.

__FILE__ returning a relative path is a known php problem and should have been fixed by now.

it seems that PHP couldn't fix it for all system, i.e. obviously it doesn't work on your freebsd machine.

please file a PHP bug and talk to them.
http://bugs.php.net/

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Mon, 2005-05-16 18:45
valiant wrote:
please file a PHP bug and talk to them.
http://bugs.php.net/

I have!

Until now nothing happend...

:-( :-(

What can I do to install a new gallery2 instance?
Ohhhnooo.... :( :(

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Thu, 2005-05-19 04:06

Rakso, what's the url to the bug you filed? We'll try to get some PHP devs to look at it.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Thu, 2005-05-19 08:27
 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-27 07:59

I have tryd the test posted in http://bugs.php.net/bug.php?id=27823 :

--- test.php
<?php
print __FILE__;
print "<p>";
require("test2.php");
?>

--- test2.php
<?php
print __FILE__;
?>

The output is (as expected)

/home/whatever/www/test.php
/home/whatever/www/test2.php

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-05-27 08:11

rakso, and you still get the warning in G2?

if so, here's a more complicated test case:

create in /home/whatever/www/test.php
and in /home/whatever/www/sub1/testsub1.php
and in /home/whatever/www/sub1/sub2/testsub2.php

--- test.php

<?php
print __FILE__;
print "<br>";
require("./sub1/testsub1.php");
?>

--- testsub1.php

<?php
print __FILE__;
print "<br>";
require("./sub1/sub2/testsub2.php");
?>

--- testsub2.php

<?php
print __FILE__;
?>

Expected Result:
-------------------
/home/whatever/www/test.php
/home/whatever/www/sub1/testsub1.php
/home/whatever/www/sub1/sub2/testsub2.php

works on linux (gentoo), apache 2, php 4.3.11.

if this test fails, add this test to the bug.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-27 13:10

I get the same result as you... but in another virtual host!!

In the vhost of the gallery2 installer, I get:

/home/whatever/www/tmp/test.php
./sub1/testsub1.php
./sub1/sub2/testsub2.php

and, of course, the gallery2 installer still fails...
curious!

Now I try to find out the difference between them.. .?!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-05-27 16:41

rakso, different vhosts? what's different? the filesystem? some apache configs?

however, please post my more complicated test to the php bug and tell them about all differences you find between the vhosts.

does phpinfo return different results on the two vhosts? etc.

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-27 17:16

ok, these information are now posted...

unfortunately, I cant found any differences...
:(

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-05-27 18:07

rakso,

Quote:
[27 May 9:14am CEST]

Zend extensions are loaded with (surprise surprise):

zend_extension=/path/to/some/zend_extension.so

Disable all the shared modules you're running and see if you get the
same result.

that's the last message of the php guy and you didn't answer / follow his instructions. probably you should do so now and answer, because how should he help you, if you don't work together? :)

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-27 18:09

Of course!
But as you and he can see in the postet list of extensions, there is no zend_extension.so.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-05-27 18:48
Quote:
Disable all the shared modules you're running and see if you get the
same result.

you didn't answer him etc.
i'm just saying that the next thing he will say could probably be "please do what i told ya" :)

 
rakso

Joined: 2003-07-31
Posts: 141
Posted: Fri, 2005-05-27 18:56

ok ok :)

 
cannedbrain

Joined: 2005-11-06
Posts: 4
Posted: Sun, 2005-11-06 16:06

I'm having this problem too. I created the test files and the result is as expected:

Quote:
/Users/pb/Sites/test.php
/Users/pb/Sites/sub1/testsub1.php
/Users/pb/Sites/sub1/sub2/testsub2.php

I'm using Mac OS X with PHP Version 5.0.4 installed. Already restarted Apache and also tried to install using Firefox and Camino, btw.

And how do you disable modules (as explained here)?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-11-06 16:22

you get the system check failure about __FILE__ in g2?
please post a screenshot.... hard to believe given that the test script runs perfectly.
next thing you'll have to do is adding print statements in install/steps/SystemChecksStep.class

 
cannedbrain

Joined: 2005-11-06
Posts: 4
Posted: Sun, 2005-11-06 20:04
 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sun, 2005-11-06 20:55

then you'll have to find out why our test in install/steps/SystemChecksStep.class say it isn't working correctly.

find:

    function CheckFileDirective() {
	if (strstr(__FILE__, 'install/steps/SystemChecksStep.class') ||
	    strstr(__FILE__, '\\install\\steps\\SystemChecksStep.class')) {
	    return true;
	} else {
	    return false;
	}
    }

in this file and add
print __FILE__; exit;

before return false;

 
cannedbrain

Joined: 2005-11-06
Posts: 4
Posted: Mon, 2005-11-07 07:09

What I got now is

Quote:
./steps/SystemChecksStep.class

huh?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-11-07 12:00

which is obviously not an absolute path!

can't help you there. obviously __FILE__ doesn't work reliably in your environment.
why it works in the test script, i don't know.

 
cannedbrain

Joined: 2005-11-06
Posts: 4
Posted: Tue, 2005-11-08 06:34

Bummer…

Anyways, thanks for keeping up with me. I really appreciate that.