note 73821 deleted from language.oop5.autoload by mazzanet
| From: | mazzanet@php.net | Date: | Mon, 12 Mar 2007 06:42:25 +0000 |
| Subject: | note 73821 deleted from language.oop5.autoload by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-124357@lists.php.net to get a copy of this message | ||
Note Submitter: nhawks izzat gmail dizzot com
----
I am totally stumped by a problem with my PHP 5.2 install. Help :(
__autoload() just plain don't work on my virtual private server, but it does on my home box.
Here is a super-simple scenario:
In test.php:
<?php
function __autoload($classname) {
include_once(dirname(__FILE__) . "/$classname.php");
}
$thinger = new foo();
echo $thinger->boo;
?>
In foo.php:
<?php
class foo {
var $boo;
function foo() {
$this->boo = "I wouldn't say 'boo' if this autoloader worked on my
server...\n";
}
}
?>
The result of running php test.php:
Fatal error: Cannot instantiate non-existent class: foo in /home/nhawks/test.php on line 8
Works perfectly and gracefully on my home computer ... any ideas?