CodeIgniter Forums
Codeigniter won't run with APC installed - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter Archived (from EllisLab) (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Codeigniter won't run with APC installed (/thread-28049.html)



Codeigniter won't run with APC installed - El Forum - 02-28-2010

[eluser]Dennis_gull[/eluser]
I just installed memcache and APC on my localhost and once I ran one of my codeigniter application I got spammed with this message like 200 times over:

Quote:Notice: Constant CI_VERSION already defined in C:\wamp\www\g\mvc\codeigniter\CodeIgniter.php on line 31

I tried to comment out the line but now I have an even bigger problem, the entire server crashes and I get the following error message in my apache_error.log:

Quote:[apc-error] Cannot redeclare class ci_benchmark in C:\wamp\www\g\mvc\codeigniter\Common.php on line 127.

Is there something I have to do to get APC to work correctly?

EDIT:


I solved the problem by turning off apc.cache_by_default, shouldn't I be able to have this on?


Codeigniter won't run with APC installed - El Forum - 03-01-2010

[eluser]Dennis_gull[/eluser]
anyone?


Codeigniter won't run with APC installed - El Forum - 03-01-2010

[eluser]Twisted1919[/eluser]
Forget APC . Go with Xcache .
I recently used it on one of my servers and the result was unbelievable .
From 5 Mb/req i went down to 0,7-1,5mb on high load pages . The loading time decreased from 0,4XX-0,9XX to 0,077-0,1XX .

BTW, i don't believe that building an application from zero on top of APC / Xcache / Memcached is a good idea.
Your app must scale in normal conditions , and apply these changes ONLY when your server is a powerful one and can't handle all the requests any more .


Codeigniter won't run with APC installed - El Forum - 03-01-2010

[eluser]bretticus[/eluser]
I have had APC running on my development machine (MAMP and OS X) and on my production servers for over a year now. No problems whatsoever. This could be a windows thing I suppose. Perhaps see what other op caching extensions you have running?

As you can see, I have cache by default ON on my production server:

Code:
apc
APC Support     enabled
Version     3.0.19
MMAP Support     Enabled
MMAP File Mask     /tmp/apc.TwYlFc
Locking type     pthread mutex Locks
Revision     $Revision: 3.154.2.5 $
Build Date     Sep 21 2009 16:01:14

Directive    Local Value    Master Value
apc.cache_by_default    On    On



Codeigniter won't run with APC installed - El Forum - 03-02-2010

[eluser]Dennis_gull[/eluser]
Weird that I get redeclare errors when your able to run it without any problems, do you run CI 1.7.2?

@twisted1919

I always develop for scalability for a couple of reasons:
1. you get to learn impressive tweaks.
2. the application is fast and awesome. Smile
3. you doesn't have to think about implementing complex solutions last minute.

I also develop large applications at work so its a good if I know whats possible and not.


Codeigniter won't run with APC installed - El Forum - 03-02-2010

[eluser]Twisted1919[/eluser]
This makes perfect sense ONLY if you are planning to deploy your app on a dedicated/vps server , where you can control what's installed and what not .
If you are building apps for shared hosting , building them on top of caching mechanisms as APC or even memcached is still a bad idea, but as you mentioned it's not your case .


Codeigniter won't run with APC installed - El Forum - 05-08-2010

[eluser]CroNiX[/eluser]
It seems you could also make a driver. vBulletin does this. You can have no cache, apc, memcached, etc. Then just select which one in the config and have nocache as default.


Codeigniter won't run with APC installed - El Forum - 01-22-2011

[eluser]slowgary[/eluser]
Try changing the $system variable in index.php from relative to absolute path.

Find index.php and change:
Code:
$system = '../system';
to
Code:
$system = '/var/www/system'; //change to whatever the full path to CI's system folder is on your server.