Reputation: 697
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.
Upvotes: 2
Views: 1786
Reputation: 29482
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
Upvotes: 0
Reputation: 724132
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
Upvotes: 1