2

I have a pretty weird problem:

My Class looks like this

<?php
class asd {
    private static $variable;

    public static function blabla(){
        self::$variable="blubb";
    }
}
?>

When I'm trying to call asd::blabla() with the help of the __autoload function, everything works fine. But when I'm trying to call it without autoload, using include/require I get this, right after the including

Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in path/asd.php on line 3

I don't get why it works one way and not the other. I'm not able to use the autoload mechanism in every class, so just using this isn't an option.

e: Additional info: The file where I want to include the Class is a .rdf file, which gets php parsed via the "AddType application/x-httpd-php .rdf" .htaccess entry.

If I try to include the class it in a random .php file it works perfectly fine, even with a manual include... This doesn't make sense at all.

e: more info: If I copy/paste the whole .rdf code into a .php file, everything works. If I now try to include the .php file in the .rdf file the Error arises again.

2 Answers 2

1

Just a guess: have you tried this? Notice the 5 at the end of the MIME type. I would think there's a PHP 4 installation on your server that's being run instead of your PHP 5.2 installation when you use the MIME type without the 5.

AddType application/x-httpd-php5 .rdf
Sign up to request clarification or add additional context in comments.

1 Comment

You're absolutely right! The Script was using PHP Version 4.4.9 withouth the 5 behind it. Thank you very much!
0

It looks like your server is running both php4 and php5, and your file is parsed as php4. I would guess that php5 scripts should run through cgi

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.