问题
Im trying to use EvTimer class, part of PHP ev class. I have already installed ev using pecl on my linux machine and it is visible in phpinfo()
.
I would like to run this sample:
// Create and start timer firing after 2 seconds
$w1 = new EvTimer(2, 0, function () {
echo "2 seconds elapsed\n";
});
Ev::run();
But even though i have ev extension installed and enabled, i receive not found error:
PHP Fatal error: Class 'EvTimer' not found in /bin/test.php on line 4
Anyone know why it doesnt see the class? Do i have to include it? From where?
回答1:
PHP Ev
Class is PECL
extension and not bundled with PHP.
Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/ev .
another case , open your server php.ini and search for Ev extension and enable it if exists.
来源:https://stackoverflow.com/questions/25549864/using-php-ev-class-evtimer