0

I'm trying to configure APC to work with my Symfony 1.4/Doctrine 1.2 website. I'm currently using WAMP 2.1 and I installed the APC extension successfully. When I do a phpinfo(), I get a description showing that APC is enabled.

apc
APC Support enabled
Version 3.1.6
APC Debugging   Disabled
MMAP Support    Disabled
Locking type    File Locks
Revision    $Revision: 303642 $
Build Date  Dec 1 2010 21:08:06

Directive   Local Value Master Value
apc.cache_by_default    On  On
apc.canonicalize    On  On
apc.coredump_unmap  Off Off
apc.enable_cli  Off Off
apc.enabled On  On
apc.file_md5    Off Off
apc.file_update_protection  2   2
apc.filters no value    no value
apc.gc_ttl  3600    3600
apc.include_once_override   Off Off
apc.lazy_classes    Off Off
apc.lazy_functions  Off Off
apc.max_file_size   10M 10M
apc.num_files_hint  1000    1000
apc.preload_path    no value    no value
apc.report_autofilter   Off Off
apc.rfc1867 Off Off
apc.rfc1867_freq    0   0
apc.rfc1867_name    APC_UPLOAD_PROGRESS APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_ upload_
apc.rfc1867_ttl 3600    3600
apc.shm_segments    1   1
apc.shm_size    64M 64M
apc.slam_defense    On  On
apc.stat    On  On
apc.stat_ctime  Off Off
apc.ttl 0   0
apc.use_request_time    On  On
apc.user_entries_hint   4096    4096
apc.user_ttl    0   0
apc.write_lock  On  On

However, I get an error saying APC extension isn't loaded when I try to set the query cache to use APC in the symfony ProjectConfiguration.class:

  public function configureDoctrine(Doctrine_Manager $manager)
  {
      $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CLASS, 'Doctrine_Query_Extra');
      $manager->setAttribute(Doctrine_Core::ATTR_QUERY_CACHE, new Doctrine_Cache_Apc());  //use APC to query cache
  }

Here's the error I get when running a clear cache (php symfony cc):

Fatal error: Uncaught exception 'Doctrine_Cache_Exception' with message 'The apc extension must be loaded for using this backend !' in C:..\lib\vend or\symfony-1.4.14\lib\plugins\sfDoctrinePlugin\lib\vendor\doctrine\Doctrine\Cach e\Apc.php:44

I've been googling everywhere and I can't seem to figure it out. I restarted WAMP to no avail. I'm thinking it might be an issue with the APC extension that I downloaded. I read that I had to use a VC6 compiled version for WAMPSERVER 2.1 so I did that. I found a binary labelled "php_apc_316_php53_vc6.dll". The fact that I can see that it's enabled in phpinfo() should mean it's installed properly right? Am I missing some symfony configuration prior to adding that line in ProjectConfiguration.class? On an aside, I have the exact same error when I try to use memcache as the query cache even though my memcache server is installed and running properly which leads me to believe I'm missing some sort of Symfony/Doctrine configuration step.

Any help would be much appreciated! Thanks! Frank

frankp221
  • 175
  • 3
  • 11
  • 1
    Just to clarify, you get the error using the cli and/or the web interface? If so, it might be a `php.ini` configuration (since they are different for cli and apache) – j0k Jun 28 '12 at 07:10
  • Thanks for the reply jOk, I got the error using the cli. – frankp221 Jun 28 '12 at 17:26

1 Answers1

0

Figured it out. Turns out it was an easy fix. The php I was using in my CLI was associated with a different version than the php version I setup APC with. I have 2 versions of PHP setup on my wampserver. The path environment variable in Windows 7 was set to the wrong php version directory. So when I ran "php symfony cc", it was using the wrong php version.

Credit goes here: http://oldforum.symfony-project.org/index.php/m/93957/?srch=memcached#msg_93957

Hope this helps somebody.

frankp221
  • 175
  • 3
  • 11