-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
symlink issues with php-fpm #5758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
# symlink fastcgi_param DOCUMENT_ROOT $realpath_root; permits to have the real path with the current symlink while deploying with Capifony (evoiding restarting php-fpm)
Thank you for your contribution @kendrick-k. Can you provide some docs related to your changes that explain in more detail what they are supposed to do and can we add some more detailed inline comments for people wondering about this option? |
yes sure : Capistrano is great for deploying web applications. But the “current” symlink construction causes issues with PHP-FPM and OPcache enabled. PHP-FPM will display old pages after deployment or PHP-FPM just hangs. The hanging / freeze will result in your browser loading for minutes but you will just see a white screen. To fix this, use $realpath_root instead of $document_root and set the SCRIPT_FILENAME in Nginx to pass to PHP-FPM. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; from : http://pietervogelaar.nl/php-fpm-opcache-nginx-capistrano-stable-deploy |
( this issue is painful when you don't know it... ) |
Hi @xabbuh is the comment fine for you ? Best |
@@ -269,6 +269,8 @@ The **minimum configuration** to get your application running under Nginx is: | |||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | |||
include fastcgi_params; | |||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |||
# symlink issue with PHP-FPM and OPcache. Symlink may not be refreshed, so it's necessary to use a real path (eg. after a deployment with Capifony which uses the current symlink to point towards a release directory, you may notice that PHP-FPM displays old pages or freezes) : | |||
fastcgi_param DOCUMENT_ROOT $realpath_root; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand the issue correctly, I would propose to change this to something like this:
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
# fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
# fastcgi_param DOCUMENT_ROOT $realpath_root;
But: Where is this $realpath_root
variable configured? Is that something that is predefined by Nginx?
@kendrick-k I left you a comment. Can you please check if I understood everything correctly and what you think about my suggestion? Thank you! |
Hi yes it's nice ! http://nginx.org/en/docs/http/ngx_http_core_module.html : "ngx_http_core_module module supports embedded variables => $realpath_root |
Could you then please update the pull request accordingly? |
Hello @xabbuh it's ok now :) ? |
@kendrick-k I think it's great now. :) Thank you for your work on this. |
cool, thank you too ! |
Sorry, I have to reopen. :) The PR is not merged yet as I wait for another 👍 from one of the other team members. :) |
I was just hit by this :) 👍 |
@xabbuh hi, it will be integrated within a few days ? |
Thanks very much @kendrick-k! |
symlink
permits to have the real path with the current symlink while deploying with Capifony (evoiding restarting php-fpm)