Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86759 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98521 invoked from network); 19 Jun 2015 15:46:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2015 15:46:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lerdorf.com designates 209.85.192.51 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.192.51 mail-qg0-f51.google.com Received: from [209.85.192.51] ([209.85.192.51:36055] helo=mail-qg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4F/E2-11390-F4934855 for ; Fri, 19 Jun 2015 11:46:26 -0400 Received: by qgal13 with SMTP id l13so37595857qga.3 for ; Fri, 19 Jun 2015 08:46:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type; bh=fHdNxrwddYs8bUis0t6V4zXgHxBeGoaDh+geljly9GA=; b=WWdp4ryihC6yk3C3aabDF7b+j1Z/SWzJCGx66CO8rZGXhHUKAGjFb0R6uVs+bSAPkY ebOCvbL3TEnwlumRE2FExtHfqrBMl02vPPnGl7FY6TTNBMgwf5e920Amiv9x6p3MD5bt I3lO8O68IUjAK3f9r2xEDit2qYK89bFrDvZpuMRRlFgQN+ysnLK7IZH5qk9VmnUAvs/2 1bo4kOOke/wB99GvRvD9+hcrHRnB1bZbTZVt72F/95V+YHz6UIVM4oxrM4/aAiXr9Yj+ gTabwnTpwN9+N94pMQRpQ548rNJqZZ/0sqCpDqQRIPwk4/ElTrbDN70ajlfsLmDnsQYv y3tA== X-Gm-Message-State: ALoCoQkkkvAN27iRaUpnSFeVq8wSmTyhhtwo8k1NIoBnTKY4Yga3AmyAJBEbUH364YqqIpJgW8/O X-Received: by 10.140.238.214 with SMTP id j205mr22784404qhc.73.1434728780579; Fri, 19 Jun 2015 08:46:20 -0700 (PDT) Received: from [10.252.9.177] ([64.124.192.210]) by mx.google.com with ESMTPSA id 140sm5780390qhg.16.2015.06.19.08.46.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Jun 2015 08:46:19 -0700 (PDT) Message-ID: <5584394B.2070804@lerdorf.com> Date: Fri, 19 Jun 2015 11:46:19 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: internals@lists.php.net References: <55840E5D.1090809@php.net> In-Reply-To: <55840E5D.1090809@php.net> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4XRHHEudHbgQMUdxMDcqJSqA60xGvV0kW" Subject: Re: [PHP-DEV] PHP-FPM: How to clear the realpath cache on deployment? From: rasmus@lerdorf.com (Rasmus Lerdorf) --4XRHHEudHbgQMUdxMDcqJSqA60xGvV0kW Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/19/2015 08:43 AM, Sebastian Bergmann wrote: > Scenario: nginx + PHP-FPM / FastCGI. >=20 > The final step of the deployment is updating a symlink to point to the= > new version. >=20 > For N <=3D realpath_cache_ttl seconds after the deployment, some > filesystem operations fail because of outdated realpath cache entries.= >=20 > Is there a way to signal the PHP-FPM / FastCGI processes to clear > the realpath cache? If not, I think this should be added :-) I think this is a symptom of doing deploys incorrectly. If you are flipping a symlink on a live server which can happen in the middle of a request then your deploy mechanism is broken. The web server should set the document_root to the target of the symlink at the start of a request. For nginx this is a built-in feature: fastcgi_param DOCUMENT_ROOT $realpath_root; For Apache I wrote a module to do it: https://github.com/etsy/mod_realdoc= Then there is never a question of needing to clear any caches at the PHP level. See: https://codeascraft.com/2013/07/01/atomic-deploys-at-etsy/ for a more indepth explanation. -Rasmus --4XRHHEudHbgQMUdxMDcqJSqA60xGvV0kW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlWEOUsACgkQlxayKTuqOuDMUACfbSqNGKLmpdQQ8TIY7Zbg6++L 5PYAn2esB0HS8TFLghl+I8kQNqKzPQtk =Jphf -----END PGP SIGNATURE----- --4XRHHEudHbgQMUdxMDcqJSqA60xGvV0kW--