So, my problem is as follows. This code works fine when I load the page via the web browser. But when I run the script from the command line like so: "php script.php" it bombs.
script.php is:
<?php
include_once('class.WebsiteScraper.php');
$ws = new WebsiteScraper();
$ws->test();
...
?>
class.WebsiteScraper.php is:
<?php
echo 'test';
class WebsiteScraper {
public function test() {
echo 'test2';
}
}
?>
This returns the error:
PHP Fatal error: Call to undefined method WebsiteScraper::test() in ... on line 4
Only when called via the command line does this happen. Another thing to note, when I append an
error_log('hey there');
To script.php, it throws the error to the standard out, rather than in my error log. But when called from the web browser it puts it in the error log. Any ideas?