Re: APC opcode cache behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 feb. 2013, at 20:32, Marco Behnke <marco@xxxxxxxxxx> wrote:

> Am 14.02.13 16:05, schrieb Camilo Sperberg:
>> 
>> You can also write a little script that clears the APC cache, something in the line of: 
>> 
>> #!/usr/bin/php
>> <?php 
>> apc_clear_cache();
>> 
>> And execute this script each time you deploy. (can also be a command such as php -r "apc_clear_cache();"). This way you'll avoid restarting the webserver and it will clear all APC cache forcing APC to cache everything again.
> 
> since apache and cli do not share the same apc, it will not work.
> 
> -- 
> Marco Behnke
> Dipl. Informatiker (FH), SAE Audio Engineer Diploma
> Zend Certified Engineer PHP 5.3
> 
> Tel.: 0174 / 9722336
> e-Mail: marco@xxxxxxxxxx
> 
> Softwaretechnik Behnke
> Heinrich-Heine-Str. 7D
> 21218 Seevetal
> 
> http://www.behnke.biz
> 
> 

Oh true, sorry, I totally forgot.

In that case, you can always do a wget or cURL request to your server forcing it to clean APC cache through the webserver, I assume that if you're deploying through symlinks you want a really minimal downtime during update, the only bad thing about this method is that you need to protect the script from external visitors through htaccess or similar methods if you're using other webservers. Make the request like: 
wget http://localhost/apc-clear.php -O /dev/null 2>&1

man wget for more information about how to use always the correct options.


If you are using Apache, you can also give a try with a graceful restart, in red hat based systems, you would restart apache with:
/etc/init.d/httpd graceful
or
apachectl graceful

I have never tried this on a production machine so I really don't know if that is gonna work, but the idea after this method is to: 
"The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything)."
http://httpd.apache.org/docs/2.2/stopping.html#graceful

Hope this helps ^^

Met vriendelijke groet,
Camilo Sperberg

----------------
W: http://unreal4u.com
T: http://twitter.com/unreal4u


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux