Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Camilo Sperberg

On 14 feb. 2013, at 20:32, Marco Behnke  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
>> > 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: ma...@behnke.biz
> 
> 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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Marco Behnke
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
>  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: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz




signature.asc
Description: OpenPGP digital signature


Re: [PHP] APC opcode cache behavior

2013-02-14 Thread Camilo Sperberg

On 14 feb. 2013, at 15:19, "ma...@behnke.biz"  wrote:

>> Aaron Holmes  hat am 14. Februar 2013 um 03:53
>> geschrieben:
>> Hello,
>> I'm trying to find some information on APC opcode cache behavior.
>> We noticed an issue where, when switching symlinks to different versions
>> of sites, old code was running from the previous version after switching
>> the symlink.
>> 
>> Anyone know where I can find more information on this?
> 
> Yes, that is the case. And iirc it will not update the cache if the mtime of 
> the
> new "switched" file is not newer. If you switch you must either restart the
> apache or touch the files.
> 
> read more:
> http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en
> 
> And on php.net about ini configuration values
> 
>> 
>> Thanks,
>> Aaron holmes
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>> 
> 
> --
> Marco Behnke
> Dipl. Informatiker (FH), SAE Audio Engineer Diploma
> Zend Certified Engineer PHP 5.3
> 
> Tel.: 0174 / 9722336
> e-Mail: ma...@behnke.biz
> 
> Softwaretechnik Behnke
> Heinrich-Heine-Str. 7D
> 21218 Seevetal
> 
> http://www.behnke.biz
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


You can also write a little script that clears the APC cache, something in the 
line of: 

#!/usr/bin/php
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



Re: [PHP] APC opcode cache behavior

2013-02-14 Thread ma...@behnke.biz
> Aaron Holmes  hat am 14. Februar 2013 um 03:53
> geschrieben:
> Hello,
> I'm trying to find some information on APC opcode cache behavior.
> We noticed an issue where, when switching symlinks to different versions
> of sites, old code was running from the previous version after switching
> the symlink.
>
> Anyone know where I can find more information on this?

Yes, that is the case. And iirc it will not update the cache if the mtime of the
new "switched" file is not newer. If you switch you must either restart the
apache or touch the files.

read more:
http://linuxaria.com/howto/everything-you-need-to-know-about-apc-alternate-php-cache?lang=en

And on php.net about ini configuration values

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

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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