Closed EMCP closed 10 years ago
The only place the problem could exist, at this point, is with the autoloader itself. I'm not familiar with ZF2's loader, but I imagine there's a configuration file that tells it where to look for the namespace path you're using, or at the very least that you have your job class file in the default location it would expect such a class to reside (such as /path/to/vendor/phpresque/V1/Model/Apigility.php
). That's where I'd have to start, followed by making sure the Zend autoloader is actually active. The file will be included, but some projects (Zend especially) like to not execute anything until you manually call it in your own code. Not saying that's the case here - as I said, ZF2 and I are not acquainted - but something similar is the most likely culprit.
If all of that is fine, try writing a wrapper script that will include_once()
or require_once()
the ZF2 autoloader, and APPINCLUDE
that instead. Or better yet, have the wrapper script set the environment variables to configure your queues and such, then require_once('/path/to/bin/resque')
- that's been the most stable and reliable configuration in my experience. Never had much luck with APPINCLUDE
.
After a LOT of research I think I need to write an autoloader.php of my own. It would load the Zend Library and any modules I've written (and needed by the worker)
I've yet to see it done, and time is pushing me to instead go with a ZF2 project already in existence.
I'm going to close, but thank you for shedding some light on what PHP-Resque needs in order to get going. Hard coding a single PHP file worked, but the worker cannot leverage any of my pre-existing logic.. so it's quite a useless worker :)
If I try your 2nd paragraph's advice I'll come back here and update.
I'm having class not found issues with PHP-Resque, trying to enqueue a job class that resides in the ZF2 namespace.
I've tried to roll in the ZF2 ClassMapAutoloader like so with no success
sudo -u www-data APP_INCLUDE=/path/to/vendor/zendframework/zendframework/library/Zend/Loader/ClassMapAutoloader.php QUEUE=* VVERBOSE=1 php resque.php
Controller Class that Enqueues the Job
The Job Class