-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Fix to support distro dependent FPM socks directory #436
Conversation
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.
from very quick testing this morning, /var/run/php will work fine on my RedHat system ... so while its nice to have a RedHat variation of /var/run/php-fpm it may not be needed.
The original issue was ... NOT being inside the /var/run parent directory.
Verne
I doubt as standard RHEL installs don't have What is the output of the following commands on your system:
|
I did not make the new subdirectory by hand ... the VirtualMin code made it on the fly when it made the first new SOCK file as part of my testing just now.
and
also I scrolled back in my putty window to verify that before I started my test, /var/run/php did not exist. Verne |
I don't think we want to make this change - it's just increasing complexity when the current path, while non-standard, works fine as far as I can tell. |
Well .. 🙂 .. I asked you before making this change, and you welcomed it .. This is why I did it as at first I was sceptical about making this change too, and even closed that initial PR ..
Rising complexity by a few percents to already complex code makes no difference .. what makes a difference is that this change will be bug-free .. even though I tested it dozens of times with both Apache and Nginx, and in various configurations, I want you to check it thoroughly as well .. We have no right to make a mistake in such widely-used and crucial area. |
the current path DOES NOT WORK 100 percent of the time, if you have SELinux turned on :-) and I would hate for VirtualMin to take the position ... we refuse to support SELinux in any manner :-( Also note that it appears a lot of other packages use the /var/run/ directory ... Verne |
We must use conventional distro-based paths. This is what this patch is for.
|
you are correct on both points ... in fact you offer two solutions for the same issue ....
or
I like number 2 best :-) Verne |
@jcameron Jamie, all further conversations regarding this PR should be done here, rather than at #349 thread! Let's keep it all in one place.
Alright, I think I fixed it to work correctly with restores too. As far as I understand the code detecting FPM mode shouldn't be tide to exact port number or socket path. This patch should address it. It also removes no longer necessary In the future when we add PHP per-directory support with FPM mode, this code should also work just fine as we will use instead of Please review and test it. |
…een setup yet, and is redundant because we check again in script_install.cgi
Try using the latest patches it will use However, again, the main goal of this PR is to use distro dependent directory, exactly what FPM services use natively, i.e. |
I really think, while its nice I suppose to have something specific to RedHat/Centos, that /var/run/php will work fine on RedHat systems ... its not required to have something different for RedHat compared to other distros Verne |
It already all worked before this PR. |
maybe my older comments were in the other ticket .... on a RedHat system with SELinux in enforcing mode, the original path of /var/php-fpm is blocked by SELinux. so --- php-fpm that tries to use a socket file in /var/php-fpm will never ever work :-) in fact php-fpm fails to restart after VirtualMin creates that socket file and that failure to restart would take down all virtual hosts, not just ones trying to use a socket. Specifically, VirtualMin can create the file but SELinux blocks it from being opened as a socket. But -- anything in or underneath, /var/run will work, so the suggested path /var/run/php for other distros will work on a RedHat system as well. |
Does |
no it does not, which is why I opened #349 in December to replace /run/php-fpm with something that does work :-) |
This doesn't seem to be correct. I have made a clean Virtualmin Pro and keeping SELinux enabled. Updated Virtualmin code with latest checked in code including this patch and PHP FPM started without any complains, and without creating any custom rules. What didn't start was Apache, because of blocked access to But again, using system default
Isn't
No, this is not correct, sorry. Here is an example of what happens if you use I am keeping it for RHEL systems with |
your screen shot of the failure shows the path /var/php-fpm/ ... did I miss something? I thought we are looking at /var/run and perhaps /run ??? |
and I see that I had an error in my comment yesterday of
what I wrote about in December was ... change from using /var/php-fpm/ to /var/run/php-fpm/ and your screenshot shows that today, /var/php-fpm/ does not work :-) |
No, you're right. I replaced rhel path in my new code and it defaulted to I would like to know what Jamie thinks about it, and also about, matching socket name and port number loosely. |
Jamie, I simply don't remember. Also, I'm not sure if this patch won't break anything now, as it's been over a year ago since it was first submitted. I will have to re-run in-depth test over again.
Joe, I think I made it work either way, with the fall back set to I remember now, that my initial goal was to store PHP-FPM pool file in a directory that a distro expects. However, Virtualmin needs to know how to read it from any possible location for variety of reasons. I will have to review, and then re-test the code. |
Ubuntu 16 and 18 also have |
My initial point was, and still is, to stop using /var/php-fpm everywhere !! |
This PR addressed exactly that. By the way, is this because of SELinux only or there are other reasons? |
only because of SELinux --- I hope that's OK 😄 |
In fact AppArmor also doesn't work with |
I can only see this breaking things if it doesn't handle the case where an existing domain is using a different path.. |
I don't understand (maybe I don't need to) Jamie's comment/issue about existing domains ... I thought every time php-fpm started, it would read the individual xxxxx.conf file to find the socket file definition, and create that socket file on the fly. So as long as the setting in httpd.conf uses the same name/path , whatever it may be (the old one or the new one), all is good. And since these socket names are per-domain, is it an issue if some are different from others? Of course it would be cleaner and simpler for all of them to be uniform and use the same path 😄 Perhaps he is concerned that somehow one item (the xxxx.conf file or the httpd.conf line) could end up being adjusted while the other item does not get adjusted. |
So the Apache / FPM config for existing domains won't be broken, but it's also important that calls to the |
Yes, I implied that in the first place. Although, I will have to review it .. |
Looking at the code, I think it's fine as long as the .socket file never disappears. I'll merge this commit ... |
What do you mean by that ..? 🙂 |
I mean if the socket file in the Apache config was under the old directory and the file disappeared, this function would now return the old path which might not match the Apache and FPM pool configs. |
Yes, this is the issue. I could reproduce it! 🐞 With the old code the socket was set to We should sync the sockets between Apache and PHP-FPM! |
Ok that's an issue .... can you post the fully sequence of actions that triggered this issue? |
I think there is nothing to add to what I have just mentioned in my previous comment. There are clear steps to reproduce it. |
Did you have to delete the .socket file to trigger this issue? |
No. Quick steps to reproduce it:
This happens because the new code sets the socket path to |
Ok I see is ... digging into the cause now. |
Ok, this patch should fix it : b62216b |
I don't see how this patch can solve described above problem. Also, why do we even need to pre-create a socket file, isn't it something that's done by the process itself? |
Did you test it? It works for me ... |
Yes, I did test it. I can assure you it doesn't work. We already have to fix it, remember that alert we recently added? It detects the problem if you return to PHP Options page but not on the initial change .. |
You're right, I missed a case. Check out 86709a8 |
Thanks, Jamie! This patch seems to work as expected now! Although, I think it would be better to update Apache socket instead of preserving the old socket name in FPM config, as otherwise the socket name will never be updated to the new path unless the mode is changed or webserver feature is disabled. However, we can also live with the old path, I think, unless it can be changed easily .. |
I think it's safest to stick to the current path, as it would be unexpected for it to move just due to a PHP version change.. |
Got it! I thought so too! |
No description provided.