2
votes

I'm testing a DoctrineCacheBundle of Symfony on XAMPP. and IDE is phpstorm.

but I have an issue about PHP Fatal error : Class 'Memcached' not found in ...

Can you give me an advice ?

my configuration is below.

# php.ini

extension=php_memcache.dll


/app/config/config.yml

# Doctrine Configuration

doctrine:
    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true
        metadata_cache_driver:
            type: service
            id: doctrine.cache.memcached
        query_cache_driver:
            type: service
            id: doctrine.cache.memcached
        result_cache_driver:
            type: service
            id: doctrine.cache.memcached

# Doctrine Cache

doctrine_cache:
    providers:
        service_connection_memcached_provider:
            memcached:
                connection_id: "memcached_connection_service"

/app/config/services.yml

services:
    memcached_connection_service:
        class: "Memcached"
        calls:
            - [ addServers, [ "%memcached_servers%" ]]

    doctrine.cache.memcached:
        class: Doctrine\Common\Cache\MemcachedCache
        calls:
            - [ setMemcached, ['@memcached_connection_service']]

# Terminal

PHP Fatal error:  Class 'Memcached' not found in C:\xampp\htdocs\test\var\cache\dev\appDevDebugProjectContainer.php on line 2739

Fatal error: Class 'Memcached' not found in C:\xampp\htdocs\test\var\cache\dev\appDevDebugProjectContainer.php on line 2739
PHP Fatal error:  Class 'Memcached' not found in C:\xampp\htdocs\test\vendor\doctrine\doctrine-cache-bundle\Tests\Functional\Fixtures\Memcached.php on line 8

Fatal error: Class 'Memcached' not found in C:\xampp\htdocs\test\vendor\doctrine\doctrine-cache-bundle\Tests\Functional\Fixtures\Memcached.php on line 8
1
The most interesting part about this issue is that somehow vendor\doctrine\doctrine-cache-bundle\Tests\Functional\Fixtures\Memcached file is loaded even if no usages of that class is anywhere in the code that's being run. Has the same issue and this was what was really strange. - Marius BalĨytis

1 Answers

1
votes

Memcache and Memcached are different extensions.

You have a Memcache extenstion, but dependencies use better and maintained Memcached.