开发者

SplEnum does not autoload in apache — works in CLI

I'm having troub开发者_JS百科le autoloading a class I've written that extends SplEnum. I have successfully installed Spl_Types.

Strangely, the class autoloads fine when run via the CLI. I run into problems when running the scripts through apache, however.

The class is defined as follows:

<?php
namespace base\main\domain;
use SplEnum;
/**
 * Represents a colour.
 *
 **/
class Colour extends SplEnum {
...

Running this:

spl_autoload_register(array($autoLoader, 'autoLoad'));
spl_autoload_register('spl_autoload');
$colour = new base\main\domain\Colour(base\main\domain\Colour::BLACK);

Gives:

Fatal error: Class 'SplEnum' not found in [...] Colour.php on line 8

I've run phpinfo() through apache and checked that the php.ini file listed includes the spl_types extension, but still no joy.

I'd greatly appreciate any help you could offer with this.

Thanks,

Ross


I ran into this same problem, but it seems that a simple service httpd restart was needed.

SPL_TYPES used from https://github.com/davidcoallier/SPL_Types

Compiled with:

tar xvf SPL_Types-0.3.1.tgz
cd SPL_Types-0.3.1
phpize
./configure
make
make test
make install

echo -e "; Enable spl_types extension module\nextension=spl_types.so" > /etc/php.d/spl_types.ini
service httpd restart 


Have you tried:

class Colour extends \SplEnum {
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜